I get an error, what's wrong? The 'STRING' input must be either a char row vector or a cell array of char row vector

25 views (last 30 days)
Hi
I tried to build an app that using below code
----
clear
close all
clc
temp = char('');
while (~ strcmp(temp, 'yes'))
temp = input('Input text here: ','s');
end
After using "Application Compiler" to build the App
I ran exe file, the below message display.
I used R2016a, what was wrong? Please advise!
  10 Comments
Dennis
Dennis on 8 Oct 2018
I don't think this will work with input. The app is supposed to run without Matlab running or even installed. Hence there is no command line.
Where should you enter anything?
Phan Anh Hoang
Phan Anh Hoang on 11 Oct 2018
@Dennis: This app need to build with runtime included in package to make sure the App will running without Matlab.
Actually, I wrote a code that using several input from keyboard (prompt as DOS) and it was successfully build in to app two months ago. This week, I update the code and rebuild it but the error appeared on the first command that using "input" function. I tried to figure it out by writing a simple test code as posted above. The error is the same, wherever the input function is call.
I think the problem is somewhere of configuration or Matlab's version.

Sign in to comment.

Accepted Answer

Phan Anh Hoang
Phan Anh Hoang on 12 Oct 2018
I solve it. There is an option in Additional running settings in Application Compiler.
We need to uncheck the "Do not display the Windows Command Shell (console) for execution"
That all. The Input still can using.
  1 Comment
Daniya Zafar
Daniya Zafar on 2 Jan 2022
Edited: Daniya Zafar on 2 Jan 2022
Hi Phan, I am using 2021a and get the same error. How do you get to Additional runtime settings?
Weird thing is, everything was working yesterday, I didn't change anything. But now, I get this:
Error using regexprep
The 'STRING' input must be either a char row vector, a cell array of char row vectors, or a string array.

Sign in to comment.

More Answers (1)

KSSV
KSSV on 8 Oct 2018
I am not sure, but have a try on this :
close all
clc
temp = cell([],1) ;
temp{1} = char('') ;
count = 1 ;
while (~ strcmp(temp{count}, 'yes'))
count = count+1 ;
temp{count} = input('Input text here: ','s');
end

Categories

Find more on Entering Commands in Help Center and File Exchange

Products


Release

R2016a

Community Treasure Hunt

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

Start Hunting!