From: riya on 22 Jul 2010 04:25 can you please tell me the coding for these statements 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. thank you
From: TideMan on 22 Jul 2010 04:46 On Jul 22, 8:25 pm, "riya " <sharma.riya...(a)gmail.com> wrote: > can you please tell me the coding for these statements > > 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. > > thank you I think you've got the wrong end of the stick here. This forum is for people who have a go at coding their homework, have trouble, and ask for help; not for bludgers* who expect others to do their homework for them. *bludger n. A lazy person who tries to manipulate others into doing their work for them. Antipodean slang.
From: riya on 22 Jul 2010 05:28 TideMan <mulgor(a)gmail.com> wrote in message <e3f7429c-563e-48ea-acc0-8e2c02338d4f(a)n19g2000prf.googlegroups.com>... > On Jul 22, 8:25 pm, "riya " <sharma.riya...(a)gmail.com> wrote: > > can you please tell me the coding for these statements > > > > 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. > > > > thank you > > I think you've got the wrong end of the stick here. > This forum is for people who have a go at coding their homework, have > trouble, and ask for help; not for bludgers* who expect others to do > their homework for them. > > *bludger n. A lazy person who tries to manipulate others into doing > their work for them. Antipodean slang. >i have made the code now you can tell me the cause of error 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 (x==0) tline2=fgetl(fid),continue,end else tline3=fgetl(fid),continue,end TL3=[TL3 sym(tline3)]; end when i run it shows ??? else | Error: Illegal use of reserved keyword "else". tell me the solution please
From: Nic Roberts on 22 Jul 2010 05:47 > 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 (x==0) > tline2=fgetl(fid),continue,end > else > tline3=fgetl(fid),continue,end > TL3=[TL3 sym(tline3)]; > end > when i run it shows > ??? else > | > Error: Illegal use of reserved keyword "else". > tell me the solution please The use of 'end' before the 'else' is not needed.
From: riya on 22 Jul 2010 05:55 "Nic Roberts" <dingtheking(a)googlemail.com> wrote in message <i2942n$c0j$1(a)fred.mathworks.com>... > > > 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 (x==0) > > tline2=fgetl(fid),continue,end > > else > > tline3=fgetl(fid),continue,end > > TL3=[TL3 sym(tline3)]; > > end > > when i run it shows > > ??? else > > | > > Error: Illegal use of reserved keyword "else". > > tell me the solution please > > The use of 'end' before the 'else' is not needed. >i have removed the end which does not show any error ..but my code does not fulfill my purpose which is 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. please tell me the corrections to be made
|
Next
|
Last
Pages: 1 2 Prev: ANY Body tried this Next: How to delete specific content from text file? |