how to form the code with fixed number of values on x axis and variable number of values on y axis.
3 次查看(过去 30 天)
显示 更早的评论
x=1, y= 2,3;
x=1, y= 2,3,4;
x=1, y= 2,3,4,5;
x=1, y= 2,3,4,5,6;
x=1, y= 2,3,4,5,6,7;
x=1, y= 2,3,4,5,6,7,8;
x=1, y=2,3,4,5,6,7,8,9;
1 个评论
Walter Roberson
2017-11-30
Duplicates https://www.mathworks.com/matlabcentral/answers/370127-marix-calculation-with-fixed-and-changing-value
回答(1 个)
Image Analyst
2017-11-30
How about
x=1, y= [2,3];
x=1, y= [2,3,4];
x=1, y= [2,3,4,5];
x=1, y= [2,3,4,5,6];
x=1, y= [2,3,4,5,6,7];
x=1, y= [2,3,4,5,6,7,8];
x=1, y= [2,3,4,5,6,7,8,9];
or
for k = 1 : 9
x=1
y = 2:k
end
or
x = 1;
y = 2 : randi(9, 1, 1)
Or any number of other ways depending on what your intent is.
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!