Store 2 inputs in 2 arrays
2 次查看(过去 30 天)
显示 更早的评论
The 'coordX' input is stored in an array but how do I get the 'coordY' input to be stored in a second array?
Thanks in advance for any help.
data=[];
totalX=0;
totalY=0;
numberOfCoordinates=input('Please input the number of coordinates:');
data=zeros(1,numberOfCoordinates);
for i=1:1:numberOfCoordinates
coordX(i)=input('Please enter the X co-ordinate:' )
for i=1:1:coordX
coordY (i)=input ('Please enter the Y co-ordinate:')
0 个评论
回答(1 个)
Mouhamed Niasse
2021-5-7
data=[];
totalX=0;
totalY=0;
numberOfCoordinates=input('Please input the number of coordinates:');
data=zeros(1,numberOfCoordinates);
for i=1:numberOfCoordinates
coordX(i)=input('Please enter the X co-ordinate of a corner of the field:' )
end
for i=1:max(size(coordX))
coordY (i)=input ('Please enter the Y co-ordinate of a corner of the field:')
end
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Data Type Conversion 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!