How to store normalised data from a struct into a separate struct for each separate field
Mostra commenti meno recenti
Store = [];
%Normalize spike time on go cue time
for i = 1:length(unit)
for j = 1:length(go)
NSSpike = unit(i).times(unit(i).times < go(j) + 1 & unit(i).times > go(j) - 1); %get only those values that one second below or above
%go cue
NSSpike = NSSpike - go(j); %center around go timing
Store = [Store; NSSpike]; %vector that stores the normalized data
end
end
Unit is the struct here! 'Store' is my variable which is currently storing all of the data but it is stacked for all the fields. I want to separate the data for each field within the 'Store' variable. Any help will be appreciated, I have tried all different ways.
1 Commento
dpb
il 29 Feb 2020
Well, if you've tried all different ways, then there's no point in us trying ...there would be no options left untried. :)
W/o having any klews as to what NSSpike is, how are we to know what to do with the result? It is, guessing, a vector of some length for each element? Is this always the same length as would seem to be necessary or the code above would error on not having commensurate lengths each time you try to concatenate the new result.
What would you like the result to look like? Defining that would be the surest way to see what the syntax you would require would be.
Risposte (0)
Categorie
Scopri di più su Whos in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!