Azzera filtri
Azzera filtri

Recieving values from a 2xn matrix

1 visualizzazione (ultimi 30 giorni)
Josefine  Jonsson
Josefine Jonsson il 10 Dic 2015
Commentato: dpb il 10 Dic 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 Commento
dpb
dpb il 10 Dic 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...

Accedi per commentare.

Risposte (0)

Categorie

Scopri di più su Loops and Conditional Statements in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by