Number format coming from syms into subs leading to Excel format

1 回表示 (過去 30 日間)
Philosophaie
Philosophaie 2014 年 2 月 4 日
コメント済み: Walter Roberson 2014 年 2 月 5 日
I have equations that use "syms" variables. After the equations are finished I want to add numbers to the final equations with "subs". These equations are in Matrix form. There are a lot of Matrices so I opted to display them in Excel.
My problem is the number format coming out of the "subs" is different then the "Double" format needed for Excel so I need a way to convert them.
My interface with Excel works flawlessly when no other errors.
rr = exlSheet1.Range(['C' num2str(5)]).value;
theta = exlSheet1.Range(['D' num2str(5)]).value;
for i=1:4
for j=1:4
for k=1:4
Affinity(i,j,k)=subs(Affinity0(i,j,k),{r,h},{rr,theta})
end
end
end
exlSheet1.Range(['I' num2str(3)]).value=Affinity(1,1,1)
exlSheet1.Range(['J' num2str(3)]).value=Affinity(1,1,2)
exlSheet1.Range(['K' num2str(3)]).value=Affinity(1,1,3)
...
Warning: ActiveX - invalid argument type or value.
> In SchwarzchildAnalysis_Excel>Evaluate at 267
exlSheet1 =
Interface.Microsoft_Excel_12.0_Object_Library._Worksheet

回答 (1 件)

Walter Roberson
Walter Roberson 2014 年 2 月 5 日
Affinity(i,j,k) = double(subs(Affinity0(i,j,k),{r,h},{rr,theta}));
  2 件のコメント
Philosophaie
Philosophaie 2014 年 2 月 5 日
編集済み: Philosophaie 2014 年 2 月 5 日
is there another format that is 10 decimal or (number *10^integer) instead of a double having a 2 decimal
Walter Roberson
Walter Roberson 2014 年 2 月 5 日
At your MATLAB command line, what do you have
format
set to?
Are you referring to the format at the MATLAB level, or at the Excel level?

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeData Import from MATLAB についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by