how can i make this loop work

function gpaname
x = zeros(1,10);
y = zeros(1,10);
for i=1:10
x(i) = input('please enter your name=' , 's');
end
for j=1:10
y(j) = ('please enter your GPA=');
end
result = [x' , y'];
disp(result);
end

回答 (1 件)

madhan ravi
madhan ravi 2020 年 7 月 11 日

0 投票

function gpaname
[x, y]= deal(cell(10,1));
for ii = 1:10
x{ii} = input('please enter your name=' , 's');
y{ii} = input('please enter your GPA=');
end
result = [x , y];
disp(result);
end

1 件のコメント

hedie adine zade
hedie adine zade 2020 年 7 月 12 日
wow thank you soooo much

この質問は閉じられています。

タグ

質問済み:

2020 年 7 月 11 日

閉鎖済み:

2021 年 8 月 20 日

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by