How to writematrix with a different sheet name in a for loop matlab
24 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I have the following vector of arrays
AzizSheetName ={'Joint Angle R.Ankle.X', 'Joint Angle R.Ankle.Y', 'Joint Angle R.hip.X', 'Joint Angle R.hip.Y', 'Joint Moment R.Ankle.X', 'Joint Moment R.Ankle.Y', 'Joint Moment R.hip.X', 'Joint Moment R.hip.Y'};
and there shall be the names of the sheets of a xlsx file that I would like to create
for j=1:numel(sheet_name)
writematrix(NewData{j},Newfilename,AzizSheetName(j))
end
Obviously this does not work, and this is the one that works
for j=1:numel(sheet_name)
writematrix(NewData{j},Newfilename,'Sheet',j)
end
However, I do not want things to be named sheet 1, sheet 2, ect.
Can someone help me please?
0 comentarios
Respuesta aceptada
Jan
el 29 de Abr. de 2019
What about
AzizSheetName ={'Joint Angle R.Ankle.X', 'Joint Angle R.Ankle.Y', 'Joint Angle R.hip.X', 'Joint Angle R.hip.Y', 'Joint Moment R.Ankle.X', 'Joint Moment R.Ankle.Y', 'Joint Moment R.hip.X', 'Joint Moment R.hip.Y'};
for j=1:numel(sheet_name)
writematrix(NewData{j}, Newfilename, 'Sheet', AzizSheetName{j});
% ^^^^^^^ ^ ^ curly braces
end
"Obviously this does not work" - instead of such a general statement, a copy of the complete error message would reveal some details.
Más respuestas (0)
Ver también
Categorías
Más información sobre Spreadsheets en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!