MATLAB: Indexing a field in a structure


I need to save every mean from this structure into a vector. (there are 270 fields)
m_vector(1:270) = s(11).structure.mean(1:270) does not work and I am not sure why

Best Answer

  • Your indexing is not correct. If s(11).structure has exactly 270 elements, then all you need is this:
    out = [s(11).structure.Mean]
    Read more on how to use comma-separated lists:
    For an explanation of why your indexing is not correct: