Import XLSX in MATLAB using input() and xlsread()?
14 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Sergio
el 24 de En. de 2024
Comentada: Sergio
el 24 de En. de 2024
Hi, I am trying to create code for a script file in which Matlab's function input() is used to read the name of an excel file whose data is then read in using the function xlsread().
The thing I don't understand is why there is a need for input() when we have xlsread()?
My attempt is, however it doesn't open the XLSX file.
I think the input() part is vital, but how are these used together?
Thanks
xlsread(test.xlsx)
2 comentarios
Enrique
el 24 de En. de 2024
Morning Sergio,
First thing you need to try is to enter your excel file as a string
Now you have
xlsread(test.xlsx)
And you would like
xlsread('test.xlsx')
Second thing is that matlab does not recommend xlsread anymore. Use readtable instead. Example:
T = readtable("patients.xls",ReadRowNames=true);
T(1:5,1:4)
Hope it helps, if you need anything else we can go further.
Best regards,
Enrique
Respuesta aceptada
Dyuman Joshi
el 24 de En. de 2024
There is no need for using input(). Directly specify the filename to the call -
data = readmatrix('test.xlsx')
%or
data = readtable('test.xlsx')
Refer to the documentation pages linked for more information.
0 comentarios
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!