MATLAB: Input function to enter array elements

enter array elementsinput function

Hi guysy,
I have different cases I want to calculate and plot. I am wondering if there is anyway to use input function to prompt user to choose the cases through typing the cases numbers to array with flexible length for example Cases=inpute [ 1 3 5] or Cases=inpute [ 1 3 5 9]
I appreciate your help thanks

Best Answer

Cases = input('Enter cases with [ ] around them');
and user would have to type in
[1 3 5 9]
including the []
Alternately,
Cases_str = input('Enter cases separated by spaces or commas' 's');
Cases = num2str(Cases_str);
Related Question