Naming Excel Sheet with xlswrite.

4 visualizaciones (últimos 30 días)
Samuel Brewton
Samuel Brewton el 19 de Feb. de 2021
Editada: Samuel Brewton el 19 de Feb. de 2021
I am looking to use xlswrite to export a matrix to excel. For the naming convention, I want to name it based on a variable (ex: x=30) so that the excel file would be named "Rule30.xls".
I've tried using xlswrite(FILE,ARRAY) as xlswrite( ('Rule%d',x) , matrix), similar to how I'd use fprintf.
Here would be a quick code example:
x=30 % Defines x
matrix = eye(x) % Creates an identity matrix that's x by x
xlswrite(('Rule%d',x),matrix) % Writes 'matrix' as an excel file titled 'Rule30.xls'

Respuesta aceptada

Fangjun Jiang
Fangjun Jiang el 19 de Feb. de 2021
FileName=['Rule',num2str(x)]
FileName=sprintf('Rule%d',x)

Más respuestas (0)

Etiquetas

Productos


Versión

R2019a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by