import textoveho suboru do matlabu

Daniel Valuch daniel.valuch@orange.fr
Pátek Květen 22 00:49:26 CEST 2009


parada, dakujem za inspiraciu. trochu som si to upravil k obrazu svojmu 
a funguje presne ako ma.
b.


Michal Lukac wrote:
> Nieco podobne som robil, ale som pouzil fciu fget1() naraz nacita cely 
> riadok, takze uz len porovnanvat s hlavickou "Frequency"    "Data Trace" 
> "Memory Trace" a potom dalsi riadok su uz data.
> 
> clear all
> fid = fopen('rrr.txt', 'rt');
> i=1;
> aa=[0 0 0];
> tline = fgetl(fid);
> while feof(fid) == 0
>   matches =strfind(tline,'"Frequency" "Data Trace" "Memory Trace"');
>   if ~isempty(matches)
>     tline = fgetl(fid);
>     while feof(fid) == 0
>       aa= textscan(tline,'%f%f%f');
>       bb(i,:)=[aa{1} aa{2} aa{3}]
>       i=i+1;
>       tline = fgetl(fid);
>     end
>   end
>   tline = fgetl(fid);
> end
> 
> michal
> 
> ----- Original Message ----- 
> From: Daniel VALUCH
> To: hw-list@list.hw.cz
> Sent: Thursday, May 21, 2009 9:45 PM
> Subject: import textoveho suboru do matlabu
> 
> 
> ucim sa v matlabe a neviem rozlusknut znacne trivialnu zalezitost :-) chcem 
> naimportovat textovy subor ktory ma hlavicku a potom obsahuje tri stlpce 
> ciselnych dat (vid nizsie). Naimportovat subor od zaciatku viem (pouzivam 
> textread), ale neviem dojst na to ako odignorovat tu hlavicku... Funkcia 
> textscan dokaze robit seek v ramci suboru, ale neviem ako ziskat poziciu 
> znaku v subore ktorym sa zacina ciselna cast. Viete mi niekto prosim 
> poradit?
> dik, b.
> 
> 
> "4395A REV1.04"
> "DATE: Feb 22 2009"
> 
> 
> 
> "CHANNEL: 1"
> "MEASURE TYPE: A"
> "FORMAT TYPE: SPECTRUM   UNIT: dBm"
> "NUMBER of POINTS: 801"
> "SWEEP TIME: 00:01:10"
> "SWEEP TYPE: LIN FREQ"
> "RF OUT: OFF"
> "SOURCE POWER:  0 dBm"
> "RBW:  300 Hz   VBW:  300 Hz"
> 
> "Frequency"    "Data Trace"    "Memory Trace"
> 1.000000000000E+07    -1.130261E+02    0.000000E+00
> 1.011250000000E+07    -1.124581E+02    0.000000E+00
> 1.022500000000E+07    -1.133594E+02    0.000000E+00
> 1.033750000000E+07    -1.126861E+02    0.000000E+00
> 
> 
> 
> 
> _______________________________________________
> HW-list mailing list  -  sponsored by www.HW.cz
> Hw-list@list.hw.cz
> http://list.hw.cz/mailman/listinfo/hw-list
> 
> 
> 
> __________ Informacia od ESET NOD32 Antivirus, verzia databazy 4094 
> (20090521) __________
> 
> Tuto spravu preveril ESET NOD32 Antivirus.
> 
> http://www.eset.sk 
> 
> _______________________________________________
> HW-list mailing list  -  sponsored by www.HW.cz
> Hw-list@list.hw.cz
> http://list.hw.cz/mailman/listinfo/hw-list
> 
> 




Další informace o konferenci Hw-list