Include variables in matlab user input
4 次查看(过去 30 天)
显示 更早的评论
Hi guys, Basically I just want to use a variable that I've already declared when asking a user for input.
a= input('Pick a letter') b= input('Now ask something about the letter' a '? ')
Something along those lines. Even if I have to convert 'a' to another format after its found would be fine. I've looked over the internet and matlabs help for input a fair bit but can't find anything. Does anyone know if this is possible? Thanks in advance Josh
0 个评论
采纳的回答
Matt Fig
2011-6-15
Is this what you are after?
a = input('Pick a letter: ','s');
b = input(['Now ask something about the letter ', a, '? '],'s');
6 个评论
Matt Fig
2011-6-15
Yes, I almost always use commas to separate values unless it is a pure list of non-negative numbers.
[2,-3,4,-6,7]
['This ','string ','is built from ','sub-strings.']
but only for non-negative integers
[3 4 5 6 7]
Also, note the other: [1;2;3;4;5]
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Creating and Concatenating Matrices 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!