Write a row with mixed data to xlsx using xlswrite
3 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
I need to create a spreadsheet with mixed data (one number, one string, one number). Even though I convert a row into a string, the final output is an empty spreadsheet. Here is an example of code summarizing my problem:
id = 1
folder = cellstr('folder')
pos = 3
oneRow = {num2cell(id), folder, num2cell(pos)}
xlswrite('Prova.xlsx', oneRow)
The row "oneRow" does not appear on the output file "Prova.xlsx".
How can I solve this problem?
Thank you!
0 Commenti
Risposte (2)
Kiran
il 28 Dic 2015
Modificato: Kiran
il 28 Dic 2015
Hi,
Input matrix to "xlswrite" cannot have nested cell array that is cells inside cell array. One workaround to your issue could be making array of individual cells like:
xlswrite('Prova.xlsx',[num2cell(id),cellstr('folder'),num2cell(pos)]);
This worked at my end.
0 Commenti
Image Analyst
il 28 Dic 2015
You have cells inside of cells. That won't work. You need numbers and strings inside the cells. Try it this way:
id = 1
folder = 'folder'
pos = 3
oneRow = {id, folder, pos}
xlswrite('Prova.xlsx', oneRow)
0 Commenti
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!