Storing values in a vector using a loop
4 ビュー (過去 30 日間)
古いコメントを表示
This is a simple version of what i'm trying to implement in a function:
d = zeros(1,N)
for i = 1:N
d(1,i)=input('Distance = ');
end
I thought I was storing the ith value in the vector, but when it saved to my workspace it came out as a scalar!?
How do I create a vector of values using a loop? Why is it not working?
4 件のコメント
回答 (1 件)
Steven Lord
2025 年 4 月 20 日
Edit: Is there a way to run a function line by line like a live script?
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Loops and Conditional Statements についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!