Take values from a matrix, line by line.

1 view (last 30 days)
Hello good day.
Waiting for your valuable help
I have the following matrix:
A = [2 4 6
3 6 9
4 8 12];
and the following variables:
W = exp ( )
D = exp ( )
V = exp ( )
What to do so that the values of matrix A are automatically taken starting with the first line and put in the exponent
for example taking the first line;
W = exp (2)
D = exp (4)
V = exp (6)
Then the values of the second line are taken;
W = exp (3)
D = exp (6)
V = exp (9)
Finally, the values of the third line are taken;
W = exp (4)
D = exp (8)
V = exp (12)

Accepted Answer

the cyclist
the cyclist on 6 Sep 2019
I would do this as follows:
WDV = exp(A.');
and any time later I need to refer to "W", I would reference WDV(:,1).
If you absolutely, positively need to refer to this variable as "W", then I would do
W = WDV(:,1);
and so on. But this is probably a terrible idea. See this question/answer for some reasons that will be relevant to you.
Is there a reason this does not work for you?

More Answers (0)

Community Treasure Hunt

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

Start Hunting!

Translated by