need to create a vector through input in the script
13 ビュー (過去 30 日間)
古いコメントを表示
Tommaso Decataldo
2019 年 9 月 25 日
編集済み: KALYAN ACHARJYA
2019 年 9 月 26 日
Hi there, I need to create a script in which I ask the user to input a vector of n elements. In this script, n is already inserted by the user previously and now my objective is to create this vector (nx1) in which each element is a number inserted through an input function by the user. Thanks in advance.
0 件のコメント
採用された回答
KALYAN ACHARJYA
2019 年 9 月 25 日
編集済み: KALYAN ACHARJYA
2019 年 9 月 26 日
function result=test( )
n=input('Enter the vector length: ');
result=zeros(1,n);
for i=1:n
result(i)=input('Enter the vector Element');
end
disp('The Entered vector is: ')
disp(result)
end
Please try to understand the code and make changes as per requirements (if needed). Ultimate way of learning is "doing it yourself".
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Whos についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!