MATLAB Answers

michio
1

Exported formulas on excel sheets resulted in text which would not be evaluated automatically

michio
さんによって質問されました 2019 年 10 月 18 日
最新アクティビティ michio
さんによって コメントされました 2019 年 10 月 28 日
According to the past post, simply using xlswrite and writecell to export formula as text (char/string) will result in formulas in Excel.
However executing the following on R2019a, Windows 10.
a={'1','2','=sum(a1,b1)'}
a(2,:)={'4' '5' '=sum(a2,b2)'}
a(3,:)={4, 5 ,'=sum(a3,b3)'}
% xlswrite('Book.xls',a)
writecell(a,'Book.xls')
creates the following.
Do we need any set-up on Excel side or is there anything that can be done from MATLAB side? Using ActiveX is of course an option, but I'm looking for simpler option.

  0 件のコメント

サインイン to comment.

製品


リリース

R2019b

1 件の回答

回答者: Walter Roberson
2019 年 10 月 18 日
 採用された回答

That post does not say that the formulas will be executable once written by xlswrite.
None of the table based operations such as writetable or writecell are able to create executable formulas. You will need to use ActiveX methods.

  6 件のコメント

Image Analyst
2019 年 10 月 18 日
So I guess the key is to have an extension of .xlsx rather than .xls.
michio
2019 年 10 月 18 日
It was indeed for xlswrite, but neither of them works (as in the formulas executable) with writecell.
michio
2019 年 10 月 28 日
Setting 'UseExcel' to true resolves the issue with writecell.
a={'1','2','=sum(a1,b1)'}
a(2,:)={'4' '5' '=sum(a2,b2)'}
a(3,:)={4, 5 ,'=sum(a3,b3)'}
writecell(a,'Book.xls','UseExcel',true)

サインイン to comment.



Translated by