Input a range of numbers with strings as well
Show older comments
Here is what I use right now:
m = input('Number? ');
for ind = length(m):-1:1
filename = ['Data#' num2str(m(ind)) '.txt'];
Output Data{ind}= importfile(filename);
end
And this serves my purpose to input a range of numbers like [1:5] or [2,6,3,5]. But now I would like to be able to also use strings in the input along with the range such as [1:3,2R, 4 Word, 10] in order to input these text files: Data#1.txt, Data#2.txt, Data#3.txt, Data#2R.txt, Data#4 Word.txt, and Data#10.txt I know that cells allow me to have mixed arrays but I cannot figure out away to allow the input of 1:3 to be {1, 2, 3}. Can anyone help me achieve what I am trying to do?
Accepted Answer
More Answers (0)
Categories
Find more on Import, Export, and Conversion in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!