How to export "duration" output and "symbolic variables" in excel file ?
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Antworten (2)
Walter Roberson
am 21 Mär. 2018
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 Kommentare
Jan Siroky
am 21 Mär. 2018
Duration can be converted to numeric using functions such as days or hours.
0 Kommentare
Siehe auch
Kategorien
Mehr zu Data Type Conversion finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!