0

i have this cell array in my Matlab code

energie{n} = [Ea, Ed];

In which Ea contain 1 value and Ed contain 3 values i don't know how to call the second value of Ed . For example if i have this

Ea =
 50.9982

 Ed =
 1.1777   19.0690   20.2442    8.5108 

and i want to call '19.0690' how can i do it ?

I tried this

ans=energie{1:n:3}

but it give me

50.9982 1.1777 19.0690 20.2442 8.5108

Also i tried

energie{n}{2}(3)

But i got this error message

"Cell contents reference from a non-cell array object."

root
  • 59
  • 1
  • 7

1 Answers1

0

energie{n} is a 5 element matrix. You are wanting the 3rd element of it, so energie{n}(3) will give you the element.

If you had done energie{n} = {Ea Ed} then energie{n} is a cell array containing 2 elements, where the first element is a scalar and the second element is a 4 element vector. In this case energie{n}{2}(2) would work.

Phil Goddard
  • 10,571
  • 1
  • 16
  • 28