Info

この質問は閉じられています。 編集または回答するには再度開いてください。

How do I loop through a matrix using values from a vector

5 ビュー (過去 30 日間)
Ale
Ale 2017 年 9 月 29 日
コメント済み: Ale 2017 年 9 月 29 日
This is what I have so far :
function [x, y] = make1DGrid(n,l) %L (lenght of domain) %Nel (Number of elements) x = linspace(0,l,n) y = vec2mat(x, 2) end
>> make1DGrid(11,10)
x =
0 1 2 3 4 5 6 7 8 9 10
y =
0 1
2 3
4 5
6 7
8 9
10 0
ans =
0 1 2 3 4 5 6 7 8 9 10
but my matrix needs to look like this :
y =
0 1
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
  2 件のコメント
Stephen23
Stephen23 2017 年 9 月 29 日
Duplicate:
https://www.mathworks.com/matlabcentral/answers/358962-how-do-i-loop-through-a-matrix-using-values-from-a-vector
Ale
Ale 2017 年 9 月 29 日
I think it was because the page refreshed while I was adding the tags.

回答 (0 件)

この質問は閉じられています。

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by