I want to extract in a matrix all the datas of the field Latency. I passed to extract the first value with the code
trials_struct{1,1}.Latency
But I don't find the solution to get all value in one matrix in one loop.
dataextractfield
trials_struct{1,1}.Latency
Best Answer
Your misleadingly named trials_struct is actually a 1x186 cell array, each cell contains one scalar structure with multiple fields. Unfortunately the fieldnames are not all the same: if they were then your data would be better stored in a non-scalar structure, then the solution to your task is also trivial:
Unfortunately because the fieldnames differ you will have to stick with a cell array and use a loop or cellfun:
In this case it worked, but note that if any of the scalar structures does not have that field Latency, then the code will throw an error.