filling matrix instead of using for loops
이전 댓글 표시
Hi,
I want to fill my Matrix in following way.
I have 2 vectors that are used by my Matrix. Say
VectorA = 1:10;
VectorB = 20:29;
And I want to use them to fill my matrix.
for m = 1:10
for n = 20:29
MatrixK = [sin(m),cos(n);cos(n).*sin(m),exp(m)];
% MatrixK will be used here
end
end
However, as you know, it is not efficient as these 2 for loops have to be run by 100x100 times. How can I do it efficiently? I am not sure I have fully defined my problem. Most likely, I will add sth.
Thanks
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 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!