storing for loop answer into matrix
Mostrar comentarios más antiguos
Hi, i have this code and it gives me 8 answers of matrix "locations". Is there a way I can write another line of code to store the loop answers into a matrix? The end result should be a 1 x 8 cell array.
Thanks!
for i = 1:8
fefinsessionn = find(sessions_fef==i); %%extract the fef neurons that appear in the selected trials
trialsize = size(trials(i).val); %%number of trials in the selected session (i only want columns?)
A = dataset_fef_sac_all(fefinsessionn,:); %%selected rows/neurons in mean fef dataset
A(:,(trialsize(:,2)+1):621) = [];
B = ix_all(i); %%based off i, to select the respective ix, to use {ix .... ix_s8}, create ixall matrix
B2 = cell2mat(B);
[locations,~] = find(B2);%%location of target in respective ix
end
Respuesta aceptada
Más respuestas (1)
Daniel M
el 28 de Oct. de 2019
1 voto
It would often be much faster for you to just look up the documentation than to post a question here and wait for an answer. I suggest learning to use the documentation as your first course of action when you don't know something.
Categorías
Más información sobre Loops and Conditional Statements en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!