How to export "duration" output and "symbolic variables" in excel file ?
2 ビュー (過去 30 日間)
古いコメントを表示
I need to store the outputs of each iteration in my for loop in a excel file. Tried to use xlswrite(). However, the error I get is 'Input data must be a numeric, cell, or logical array.'
One of my outputs is a duration of the form '03:15:00' obtained from A = duration(10,0,0); and haven't been able to store this in any form.
The rest of my outputs are symbolic variables "1X1 Sym". I did store them using dummyarray(i,j) but I need the data in .xls. Please help !!
Thanks in advance, Abhijit
0 件のコメント
回答 (2 件)
Walter Roberson
2018 年 3 月 21 日
You can cellstr() the duration array to get a cell array of character vectors that you can include in the cell of data to be written by xlswrite()
For a sym array, with current versions of MATLAB, you can use
sym_cell = arrayfun(@char, YourSymArray, 'uniform', 0)
but in some of the older versions you could not arrayfun() a sym array; in those older versions sometimes a for loop was easier. But you could
sym_cell = arrayfun(@(IDX) char(YourSymArray(IDX)), reshape(1:numel(YourSymArray),size(YourSymArray)), 'uniform', 0)
0 件のコメント
Jan Siroky
2018 年 3 月 21 日
Duration can be converted to numeric using functions such as days or hours.
0 件のコメント
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!