Recieving values from a 2xn matrix

1 次查看(过去 30 天)
Josefine  Jonsson
Josefine Jonsson 2015-12-10
评论: dpb 2015-12-10
Hi! I have a matrix X=[0 0 0 0 0; 0.5 0.5 0.5; osv] until 4 it's always a nxn matrix, same values on each row, +h on the next row. Depending on which steplenght (h) I use, it's very important that I can change them whenever I want. I also have a script, a function who delivers a 2xn matrix. Where row 1 is my X-values and row 2 I'm interested in. The problem is that I want to make a Y-matrix= [y(0) y(0) y(0);y(0.5) y(0.5) y(0.5);....] the problem is that my function is dependent on another variable, t, f(t) but returns a [XxY]-matrix. Can I in some way do a key-value for-loop that was possible in Python? Like return all x from my X matrix and row 1 and the key-value and row 2 is my Y-values.
  1 个评论
dpb
dpb 2015-12-10
I can't quite follow what it is that is the key; can you give a short simulated or real set of data and illustrate with it what you're inputs and desired outputs are, please?
I'm positive it can be done; and likely w/o any for loops in Matlab but need more specifics to write actual code.
Meanwhile look for the phrase "logical addressing" in the documentation and perhaps (likely?) nirvana will occur on its own...

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Loops and Conditional Statements 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by