Having a problem with for loops. In the given code I need to store the 4 values in 4 seperate places like x1,x2,x3,x4, is this the correct way to write it ? and if my xf is defines in linspace then I'm having a error that the indices aren't compatib
1 次查看(过去 30 天)
显示 更早的评论
for m=1:n
x(m)=input('Enter x coordinate : ' );
y(m)=input('Enter y coordinate : ');
z(m)=input('Enter z coordinate : ');
%field point - source point for getting vector r
xi(m)=xf-x(m);
yi(m)=yf-y(m);
zi(m)=zf-z(m);
end
0 个评论
采纳的回答
KSSV
2020-3-17
x = rand(1,4) ; % your four values goes here
x(1) % x1
x(2) % x2
x(3) % x3
x(4) % x4
0 个评论
更多回答(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!