ammar
ammar

Reputation: 33

How to call a structure variable?

I am working with parallel execution in MATLAB. How can I access the data inside Structure inside Class ? This is the code :

>> clust

clust =

   Lab 1: class = struct, size = [1  2]
   Lab 2: class = struct, size = [1  2]
   Lab 3: class = struct, size = [1  2]
   Lab 4: class = struct, size = [1  2]

>> [clust{1}]

ans = 

1x2 struct array with fields:

    Data

Upvotes: 0

Views: 334

Answers (1)

Edric
Edric

Reputation: 25160

clust is a Composite, which behaves a little like a cell array, so using {} indexing is correct to extract the value from a single worker. Those values are arrays of struct, and can be accessed in the usual way. So, it should work to do this

V1 = clust{1};
D = V1(1).Data

Upvotes: 1

Related Questions