Input a range of numbers with strings as well
이전 댓글 표시
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?
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Cell Arrays에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!