If someone could figure out whats wrong with my code i will rate life saver. Any
ID: 3624659 • Letter: I
Question
If someone could figure out whats wrong with my code i will rate life saver. Any help is appreciated.
Error Message "Undefined function or method 'making' for input arguments
of type 'char'"
fid = fopen('My Documentsproj2.csv', 'w');%creates a file in my document
%.csv makes the data accessible to excel
if (fid < 0); %determines if variable fid opens in mydocuments
disp('error')%displays and error message if fid value is -1
end
for w=10:20:20000;
re=5.08;% Voice coil resistance
n=0.76;
k=0.0104;
f= n*pi;
fs=35.2;%Hz-Driver Resonant Frequency
ws=2*pi*fs; %Angular Frequency
lg=log(ws);
res=32;%ohms
qms=2.8;
s=1j*w;
zl=k*w.^2*(cos(f/2)+ 1j*sin(f/2));
zvc= zl+ re + ((res*(1/qms)*(s/ws))/((s/ws).^2+(1/qms)*(s/ws)+1));
rl= real(zvc);
Z_mag= abs(zvc);
z_phase=atan(imag(zvc)/real(zvc));
fprintf(fid, '%10.2f %10.2f %10.2f %10.2f ' ,lg, Z_mag, z_phase,rl);
end
Explanation / Answer
Dear Ron,
the way u are dealing with csv files is wrong.
u are handling them in same way as text files in matlab.
this is not the way to wrtie to csv files.
fprintf is supposed to use with csv files that y u r getting error.
plz change your lineto this
fopen('My Documentsproj2.txt', 'w');
or
use xlswrite
for moreinfo plz go thorugh this.
http://matlab.izmiran.ru/help/techdoc/ref/xlswrite.html
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.