Transferring/Copying Data between Cell Arrays, Skip NaN values: Updated Code
Mostrar comentarios más antiguos
I have the following code
for i = [1 10 100 2 20 200 3 30 300 4 40 400 5 50 500 6 60 600 7 70 700 8 80 800]
[row,col]=cellfun(@(s) find(s==i),gait_events_cut_inter,'uni',false);
%row = cellfun(@(s) round(mean(s)),row,'uni',false);
%or
row = cell2mat(cellfun(@(s) round(mean(s)),row,'uni',false));
order = floor(single(log(i)./log(10)));
if order==2
i=i/100;
e=3;
elseif order ==1
i=i/10;
e=2;
else
i=i;
e=1;
end
for j=1:3
gait_events_inter{j}{i,1}(e,1)=row(j);
end
end
Everything works up to saving the data in gait_events_inter. So, I have roww with 3 values (either as an array or cell array - what ever makes the transfering easier) and I was able to copy those 3 values to the corresping outernested cell 1,2,3, on the innernested cell on row i and row e in the innermost array to create a cell array similar to:

- But, there will be some cases like row 2 or 7 in the image, where roww will be NaN for the higher order i, but in those cases, I do not want to transfer the NaN values. How do I check for that? I was thinking of using e, if higher than 1, and NaN, to skip (contine).
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Structures 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!