error using open, too many input arguments. error in fopen
Show older comments
I have a m.file which looks something like this.
for p = 1:2
if p==1
[data,txt,raw]=xlsread('subject_1.xlsx');%%this is reading file of subject 1
fid4=fopen('new_1_datafile.dat','w');
end
if p==2
[data,txt,raw]=xlsread('subject_2.xlsx'); %%%%%%reading file of subject 2
fid4=fopen('new_2_datafile.dat','w')'
end
...
...
%%%written fid1,fid2,fid3 datafiles
...
...
...
%%%there are lots of lines where i calculate different things for each subjects (there are 72 different %%%subjects but for simplicity i am just trying with 2).
fprint(fid4,.......) %%%printing out some important data
fclose(fid1)
fclose(fid2)
fclose(fid3)
fclose(fid4)
end
how can i make sure the fid4 file for the first subject is cleared before writing fid4 file for the second subject? With the above code, I am getting an error message which says, 'error using open, too many input arguments'. The error shows in line 8 when opening fid4 for second subject. So I think it is because I am opening the same file again for the second subject which has been already written for the first subject. But I have allocated different datafile name for the fid4 files for the 2 subjects. Why am I getting this error?
Accepted Answer
More Answers (1)
Hussain Baloch
on 7 Dec 2018
0 votes
open system ('PV50')
nvals = 0;
figure
for gval=0.2:0.2:1
nvals=navals+1;
gvalsStr-num2Str(oval,3);
set_param('PV50/G1','Gain',gvalStr);
sim('PV50');
plot(v,i);
hold on
end
hold off
this is not working pls help urgently
Categories
Find more on Data Type Identification in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!