how to get string as output from inputdlg?

조회 수: 6 (최근 30일)
amirhossein sarfi
amirhossein sarfi 2019년 5월 20일
댓글: amirhossein sarfi 2019년 5월 20일
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.

채택된 답변

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Migrate GUIDE Apps에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by