Why does my variable not run through as a string?
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Joseph
am 14 Nov. 2014
Kommentiert: Star Strider
am 25 Jun. 2018
Whenever I run my function to load a name and return an excel file for that name, I get this error:
Error using xlsread (line 122) Filename must be a string.
Error in loadNCIR (line 9) [~,vaccineName,~] = xlsread(excel);
function [Name] = loadName( Name )
excel = inputdlg(['Please enter the name for the ' Name ' xls file: ']...
,'s');
if strcmp(excel, '') == 1;
Name = {};
else
[~,Name,~] = xlsread(excel);
end
What am I doing wrong? My input is a variable for a string, and the output should be the excel file.
0 Kommentare
Akzeptierte Antwort
Star Strider
am 14 Nov. 2014
The inputdlg function returns a cell. Use char to convert it to a string variable:
excelstr = char(excel);
2 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Spreadsheets finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!