How to save structure data to excel in matlab?
2 ビュー (過去 30 日間)
古いコメントを表示
Here is the code.
I save the solution of the multivariate equation as the structure A1s, which contains the three fields of A1, A2, E2, and the value of A1s.A1 can be seen on the command line, but the three fields of the workspace A1s are all sym type, and the value is not displayed, how to save the value of A1s as excel?
I tried xlswrite, but it doesn't support writing of sym type data.
format compact
x1=600;y1=0;z1=1200;
x2=800;y2=0;z2=-1200;
syms A1 E1 A2 E2
yt=500;zt=500;
i=0;
for xt=-5000:10:0
i=i+1;
eq1=(x1-xt).*(tan(A1)-tan(A2))+((x1-x2).*tan(A2)-(z1-z2));
eq2=(y1-yt).*(tan(A1)-tan(A2))+((x1-x2).*tan(A2)-(z1-z2)).*(tan(E1).*sec(A1));
eq3=(z1-zt).*(tan((A1))-tan((A2)))+((x1-x2).*tan(A2)-(z1-z2)).*tan((A1));
A1s=solve([eq1,eq2,eq3],[A1,A2,E1]);
fprintf('the %dth vector\n',i);
fprintf('A1');
A1s.A1;
end
A1s and A1s.A1 looks like this
>> A1s
A1s =
struct with fields:
A1: [1×1 sym]
A2: [1×1 sym]
E1: [1×1 sym]
>> A1s.A1
ans =
0.13058472475286441634383957631484
0 件のコメント
採用された回答
その他の回答 (0 件)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!