pulling a value from a column matrix
    3 次查看(过去 30 天)
  
       显示 更早的评论
    
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
0 个评论
回答(2 个)
  Star Strider
      
      
 2016-7-14
        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 个评论
  Star Strider
      
      
 2016-7-14
				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
      
      
 2016-7-14
        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)
0 个评论
另请参阅
类别
				在 Help Center 和 File Exchange 中查找有关 Logical 的更多信息
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!