MATLAB爱好者论坛-LabFans.com

MATLAB爱好者论坛-LabFans.com (https://www.labfans.com/bbs/index.php)
-   MATLAB论坛 (https://www.labfans.com/bbs/forumdisplay.php?f=6)
-   -   [求助]matlab excel (https://www.labfans.com/bbs/showthread.php?t=4073)

b728664 2008-08-05 00:55

[求助]matlab excel
 
請問各位要怎麼把matlab裡的數值 匯入excel? 我想把它繪成圖表
l1=10;
l2=4;
fprintf(' e e2 Ax Ay \n')
fprintf(' ---------- ---------- --------- ---------- \n')
for i = 1:10
e=120+i*2;
e2=30+i*4;
Ax = l1*cosd(e)-l2*cosd(e2);
Ay = l1*sind(e)+l2*sind(e2);
fprintf('%11.f %11.f %12.3f %12.3f \n',e,e2, Ax, Ay)
end;:cry:

mtseasky 2008-08-05 03:50

fid01 = fopen('output.xls','w');
l1=10;
l2=4;
fprintf(fid01,'e\t e2\t Ax\t Ay\n'); %第一行
for i = 1:10
e=120+i*2;
e2=30+i*4;
Ax = l1*cosd(e)-l2*cosd(e2);
Ay = l1*sind(e)+l2*sind(e2);
fprintf(fid01,'%f\t %f\t %f\t %f\n',e,e2, Ax, Ay);
end;
fclose(fid01);

mathjiang 2008-08-06 12:10

回复: matlab excel
 
偶也学到了,谢谢楼上坛友!!

b728664 2008-08-07 20:41

回覆: matlab excel
 
好厲害唷,果真高手雲集,要跟你們督多學習:lovely:

mtseasky 2008-08-07 22:06

回复: matlab excel
 
也只是新手而已
一起学习了

mtseasky 2008-08-11 22:14

回复: matlab excel
 
%指定excel的页面Sheet2
Row1={'e','e2','Ax','Ay'};
xlswrite('xlsoutput.xls', Row1, 'Sheet2','A1');
l1=10;
l2=4;
for i = 1:10
e=120+i*2;
e2=30+i*4;
Ax = l1*cosd(e)-l2*cosd(e2);
Ay = l1*sind(e)+l2*sind(e2);
M(i,:)=[e e2 Ax Ay];
end;
xlswrite('xlsoutput.xls', M, 'Sheet2','A2');

b728664 2008-08-18 12:50

回覆: 回复: matlab excel
 
謝謝唷 又多會一種方法

pslpsl 2008-08-20 01:28

回复: matlab excel
 
[QUOTE=mtseasky;14625]%指定excel的页面Sheet2
Row1={'e','e2','Ax','Ay'};
xlswrite('xlsoutput.xls', Row1, 'Sheet2','A1');
l1=10;
l2=4;
for i = 1:10
e=120+i*2;
e2=30+i*4;
A...[/QUOTE]



[CODE]Row1={'e','e2','Ax','Ay'};
xlswrite('xlsoutput.xls', Row1, 'Sheet2','A1');
l1=10;
l2=4;
M=zeros(10,4);
for i = 1:10
e=120+i*2;
e2=30+i*4;
Ax = l1*cosd(e)-l2*cosd(e2);
Ay = l1*sind(e)+l2*sind(e2);
M(i,:)=[e e2 Ax Ay];
end;
xlswrite('xlsoutput.xls', M, 'Sheet2','A2');[/CODE]

mathjiang 2008-08-26 21:16

回复: matlab excel
 
再一次向坛友学习了,感觉真的很好!!!

mathjiang 2008-08-26 21:25

回复: matlab excel
 
随便问一下各位大侠,如何从excel读入数据到matlab,越详细越好哈。偶遇到了如下问题:
》xlsread('petrol.xls','a2:i11')
??? Error using ==> xlsread at 262
File D:\我的文档\MATLAB\petrol.xls not in Microsoft Excel Format.


所有时间均为北京时间。现在的时间是 11:15

Powered by vBulletin
版权所有 ©2000 - 2025,Jelsoft Enterprises Ltd.