1
非常簡單的問題,我想在for循環中用char創建一個數組。創建一個包含字符和增加數字的數組
代碼:
a = [1:5];
arr = [];
for i = 1:length(a)
arr(i) = ['f_',num2str(i)]
end
我得到錯誤:
In an assignment A(I) = B, the number of elements in B and I must be the same.
我要的是一個數組:
[f_1 f_2 f_3....]
對不起,輸入錯誤。我想寫'for i = 1:length(a)' – user5603723