Hi, can you help me fix my code? How can I convert this to a matrix using if/while/for statements?
1 回表示 (過去 30 日間)
古いコメントを表示
format long G
MERfgh = [];
i = 1;
%for i=1:11
MERfgh(i,1) = MERfff(i,1);
for j=1:11
MERfgh(i,2) = MERfff(j,1);
i = i+1;
end
%end
MERfgh
I WANT IT TO LOOK LIKE THIS:

0 件のコメント
回答 (2 件)
DGM
2023 年 7 月 3 日
Consider the example:
% some data in a column vector
MERfff = (21:31).';
% rearrange it
[xx yy] = meshgrid(MERfff);
MERfgh = [xx(:) yy(:)]
1 件のコメント
James Tursa
2023 年 7 月 3 日
Also consider this example using element-wise raise-to-power:
10.^(-1:1)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!