MATLAB Answers

how to get string as output from inputdlg?

19 views (last 30 days)
Hi everyone,
In the following script when I am trying to get sheet name from user by inputdlg as string to use for xlsread gives me the error:
Error using xlsread (line 146)
Sheet argument must be a string scalar, a character vector, or an integer.
Error in try_input (line 17)
data = xlsread(filename ,sheet ,xlRange);
the related scripts is:
sheet = inputdlg('Enter the input sheet name please:',...
'Input', [1 50]);
xlRange = 'D2:E44509';
data = xlsread(filename ,sheet ,xlRange);
Thanks.

  0 Comments

Sign in to comment.

Accepted Answer

Dennis
Dennis on 20 May 2019
inputdlg returns a cell array and not a string.
Try
data = xlsread(filename,sheet{1},xlRange);

  1 Comment

Sign in to comment.

More Answers (0)

Sign in to answer this question.

Tags


Translated by