how to change xlswrite(fichierExcelExportNom, toCopy,'Dcollage','B10'); if toCopy is a…
- User
how to change xlswrite(fichierExcelExportNom, toCopy,'Dcollage','B10'); if toCopy is a 1x5 cell
- Assistant
If
toCopyis a 1x5 cell array and you want to write its contents to an Excel file using thexlswritefunction in MATLAB, you can do so directly as long as your target sheet and range are specified correctly. In your original function call, you are writing to the sheet named 'Dcollage' starting at cell B10.If
toCopyis indeed a 1x5 cell array and you want to write the entire array to the Excel file starting at cell B10, your original function call should work correctly. However, iftoCopyis not in the format you want (for example, as a row vector instead of a column), you might need to adjust the cell array's orientation. - User
I want to change xlwrite with writecell or writematrix
- Assistant
If you want to replace
xlswritewithwritecellorwritematrix, you need to consider the format of your data.writecellis used for writing cell arrays, which can contain both text and numeric data, whilewritematrixis used for numeric matrices or string arrays. Since your data is a 1x5 cell array, you should usewritecell.Here's how you can use
writecellto writetoCopyto an Excel file:matlabwritecell(toCopy, fichierExcelExportNom, 'Sheet', 'Dcollage', 'Range', 'B10');This command writes the data in to the specified sheet and range in the Excel file. Let's break it down:
- User
do the same for xlswrite(fichierExcelExportNom, cellstr(get(handles.editPlenumTemperature,'String')),'CR','B1'); xlswrite(fichierExcelExportNom, exportFichiers,'CR','C4'); xlswrite(fichierExcelExportNom, exportData,'CR','E15');
- Assistant
To replace the
xlswritefunction withwritecellorwritematrixfor the given examples, you'll need to choose the appropriate function based on the type of data you are writing. Here's how you can handle each case:-
For
cellstr(get(handles.editPlenumTemperature, 'String')):get(..., 'String')typically returns a string or a cell array of strings, so you should use .
-