pulling a value from a column matrix
Show older comments
hi,
does could anyone tell me why
output(57,1) = E(35)
returns this:
output=
0
0
0
0
0
0
0
12735.844108
0
0
0
0
0
35722.575872
0
0
0
0
0
345.48072942
0
0
32.212963692
589.65336604
28.428010548
0
0
0
74.661832664
0
0
0
132.86355058
0
309.87304412
0
0
0
0
0
0
0
0
0
0
106.89594308
0
0
402.70431968
0
347.0927026
0
140.7713078
0
0
0
115.04715948
rather than just
output =115.04715948
Thanks
Answers (2)
Star Strider
on 14 Jul 2016
It seems ‘E’ is a cell array.
Perhaps this will do what you want:
output(57,1) = E{35}
or:
output(57,1) = E{:}(35)
A guess, since I don’t have your data.
2 Comments
C Mck
on 14 Jul 2016
Star Strider
on 14 Jul 2016
You’re not actually looking at ‘E’, you’re looking at ‘output(57,1)’, so row 57, column 1 of ‘output’, to which you have just assigned ‘E(35)’.
For example:
output(10,1) = E(35)
output =
0
0
0
0
0
0
0
0
0
115.05
It displays the entire column because you asked it to, with ‘E(35)’ now assigned appropriately.
Azzi Abdelmalek
on 14 Jul 2016
Look at this example
a=[0 0 0 1 0 0 2 0 0 3 0 0 0 4 5]
b=[6 7 8 9 10]
a(6)=b(3)
%The last line will display all the values of a, if you want to display one value
a(6)=b(3);
a(6)
Categories
Find more on Resizing and Reshaping Matrices 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!