Jordan Medlock
Jordan Medlock

Reputation: 817

MATLAB struct array field access

I have an array of structures in MATLAB and I want to plot all of the values for one key. I know you can print it by doing array.key but for some reason hist(array.key) doesn't work.

Seems simple enough but I couldn't find how to do this.

Upvotes: 1

Views: 117

Answers (1)

akk
akk

Reputation: 269

clear all
array(10).key = 1:10;
mat = [array.key]
hist(mat)

Try something like the above.

Upvotes: 2

Related Questions