Recieving values from a 2xn matrix

3 views (last 30 days)
Josefine  Jonsson
Josefine Jonsson on 10 Dec 2015
Commented: dpb on 10 Dec 2015
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 Comment
dpb
dpb on 10 Dec 2015
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...

Sign in to comment.

Answers (0)

Categories

Find more on Interactive Control and Callbacks in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!