How can I read this text file and then use in in sprintf for referencing the %d and %f attributes?
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
I have this text file.
* C:\Users\vaidy\Desktop\JAY\Labwork\Autapse_scaled_on_LTSpice\Opamp_schmitt_trigger\LTSpice_simulations\schmitt_opamp_transistor_more_randomness_v3.asc
XU1 N002 Vo vp 0 N001 level.2 Avol=1Meg GBW=10Meg Slew=10Meg ilimit=25m rail=0 Vos=0 phimargin=45 en=0 enk=0 in=0 ink=0 Rin=500Meg
C1 Vo 0 100p
R1 Vo N001 1e6
R2 N001 N002 1e3
R3 N002 0 %d
R4 N002 vr %d
V2 vp 0 5
M1 N003 N001 Vo vp PMOS1 l=1u w=2u
R5 N003 N001 %f
R6 vp vr 4k
R7 vr 0 {R7}
.model NMOS NMOS
.model PMOS PMOS
.lib C:\Users\vaidy\Documents\LTspiceXVII\lib\cmp\standard.mos
.tran 0 10e-3 7e-3 startup uic
.MODEL PMOS1 PMOS (LEVEL=2 L=1u W=1u VTO=-0.8)
.step param R7 100 1k 200
.lib UniversalOpamps2.sub
.backanno
.end
I want to use store this in a variable and use it in sprintf(variable, 1e3, 1e3, 1.5e6) format in MATLAB.
Thank you in advance.
1 Commento
Bjorn Gustavsson
il 21 Lug 2020
Terribly sorry.
As far as I know there is no suitable function for reading a file and extract data from such variable positions. I think you will have to read the file (either line by line or the full file) and then process it line-by-line and process each line according to its content and your knowledge about the forma of each line. Will you have the lines in the same order then your work is a bit simpler, but in my experience some files will have the lines in some permuted order. My suggestion is that you make a function for reading these files, and put a subfunction for parsing out the data from each type of line - that way you at least have some structure in the programme.
Risposte (0)
Vedere anche
Categorie
Scopri di più su Startup and Shutdown in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!