Displaying a string using a variable inside a loop

Asked by Jose on 31 Aug 2012
Latest activity Answered by Azzi Abdelmalek on 31 Aug 2012

HI, I want to ask user for some values.

The prompt should be something like this:

Which is the number 1?:
Which is the number 2?:
Which is the number 3?:
...

The code is here:

for i=1:a
in=input('Wich is the number ' disp(i) '?:'); 
eval (['b' num2str(i) '=in' ';']);
end

But it dont allow me to use the disp() inside the input, any idea?

0 Comments

Jose

Tags

Products

No products are associated with this question.

1 Answer

Answer by Azzi Abdelmalek on 31 Aug 2012
Accepted answer
 for i=1:a
 in=input(['Wich is the number ' num2str(i) '?:']); 
 eval (['b' num2str(i) '=in' ';']);
 end

0 Comments

Azzi Abdelmalek

Contact us