From: riya on 22 Jul 2010 05:50 i have to do the following fopen() the file for reading. loop fgetl(); exit the loop if you reach end of file; "continue" the loop if the line does not contain the key string. fgetl() three more lines; extract the useful information from the third of those and store it; loop back for more reading. fclose() the file afterwards. for which i have written the code as fid=fopen('/sim/TLV1117LV_DS/x0138322/spice/final.in.prt'); while(1) tline2=fgetl(fid); if isempty(tline2), break, end x=regexp(tline2,'operating','start'); if isempty(x) tline2=fgetl(fid),continue,end if(x~=0) tline3=fgetl(fid); TL3=[TL3 (tline3)],continue,end end which does not work please help me to get the correct code
From: Steven_Lord on 22 Jul 2010 09:21 "riya " <sharma.riya921(a)gmail.com> wrote in message news:i2948f$n2a$1(a)fred.mathworks.com... > i have to do the following > fopen() the file for reading. loop fgetl(); exit the loop if you reach > end of file; "continue" the loop if the line does not contain the key > string. fgetl() three more lines; extract the useful information from > the third of those and store it; loop back for more reading. fclose() > the file afterwards. for which i have written the code as > > fid=fopen('/sim/TLV1117LV_DS/x0138322/spice/final.in.prt'); How can anyone on this group POSSIBLY help you determine what's wrong without having access to at least a small segment of the data from this file? > while(1) tline2=fgetl(fid); > if isempty(tline2), break, end > x=regexp(tline2,'operating','start'); > if isempty(x) > tline2=fgetl(fid),continue,end > if(x~=0) > tline3=fgetl(fid); > TL3=[TL3 (tline3)],continue,end > end > which does not work please help me to get the correct code Define "does not work". Does the code not give you the results you expect? If so, what results did it give you and what results did you expect? Does the code error? If so, what is the FULL text of the error message and on which line is it thrown? Does it do something else entirely? If so, what does it do and why do you consider that to be "not work[ing]"? -- Steve Lord slord(a)mathworks.com comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ To contact Technical Support use the Contact Us link on http://www.mathworks.com
From: riya on 22 Jul 2010 09:30 "Steven_Lord" <slord(a)mathworks.com> wrote in message <i29gk7$kt0$1(a)fred.mathworks.com>... > > > "riya " <sharma.riya921(a)gmail.com> wrote in message > news:i2948f$n2a$1(a)fred.mathworks.com... > > i have to do the following > > fopen() the file for reading. loop fgetl(); exit the loop if you reach > > end of file; "continue" the loop if the line does not contain the key > > string. fgetl() three more lines; extract the useful information from > > the third of those and store it; loop back for more reading. fclose() > > the file afterwards. for which i have written the code as > > > > fid=fopen('/sim/TLV1117LV_DS/x0138322/spice/final.in.prt'); > > How can anyone on this group POSSIBLY help you determine what's wrong > without having access to at least a small segment of the data from this > file? > > > while(1) tline2=fgetl(fid); > > if isempty(tline2), break, end >sorry i worked on the code and now it works for my desired purpose ... >i have posted a new post with subject ''reading after space'' please help in doing that > > x=regexp(tline2,'operating','start'); > > if isempty(x) > > tline2=fgetl(fid),continue,end > > if(x~=0) > > tline3=fgetl(fid); > > TL3=[TL3 (tline3)],continue,end > > end > > which does not work please help me to get the correct code > > Define "does not work". > > Does the code not give you the results you expect? If so, what results did > it give you and what results did you expect? > Does the code error? If so, what is the FULL text of the error message and > on which line is it thrown? > Does it do something else entirely? If so, what does it do and why do you > consider that to be "not work[ing]"? > > -- > Steve Lord > slord(a)mathworks.com > comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ > To contact Technical Support use the Contact Us link on > http://www.mathworks.com
|
Pages: 1 Prev: pixel count in HSV image quantized into 18,3,3 bins Next: Error bar quandry. |