Excel help
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
my question is i have a data x = [2 6 7 13 27 100] and i want to store it as one data into excel. i used num2str(x) so all the data will be in one box of excel table. however, when i want to read it back i have to convert cell2mat the data which effect that it only read data as separate number. for example 27 will be 2 and 7 and 100 will be 1, 0 and 0.
what i try to do is store the data x into one cell on excel and can read back as number.
0 Commenti
Risposta accettata
Friedrich
il 23 Mag 2012
Hi,
at least this works fine for me:
x = [2 6 7 13 27 100]
xlswrite('test.xlsx',{num2str(x)})
[~,data] = xlsread('test.xlsx')
str2num(data{1})
2 Commenti
Friedrich
il 23 Mag 2012
data is a cell where you like to get the string which it contains. So data{1} gives you the value of the first element in that cell data, which is the string from EXCEL. When you would call str2num(data) you would see an error message like "Requires string or character array input".
So, this wont work because its a cell containing a string: str2num({'1'}). But you actually want str2num('1'). Thats why you have to index in it.
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Spreadsheets in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!