Hello everyone,
I have two matrices, kindly find the attached file
soho ---> size = 23×12 , each row represents an event.
omni ---> size = 8760 × 17 , each row represent an hour (timeseries data).
The first three columns are, in order, "year", "month", "day".
I need to do the following operation:
if soho_day = omni_day
take that omni_day and the following 120 rows (hours) and put them as a separate matrix with a prefix (i.e., omniSUB_1).
and so on
I have these code blocks
for n = 1:length(soho)
for m = 1:length(omni)
if datetime(soho(n,1),soho(n,2),soho(n,3),...
'Format','dd/MM/yyyy') == ...
datetime(omni(m,1),omni(m,2),omni(m,3),...
Format','dd/MM/yyyy')
for k = m:120
omniSUB{n,:} = omni(k,:);
end
end
end
end
and
Prefix = 'omniSUB_';
for i = 1:Month_length
var_name = strcat(Prefix, num2str(i));
data_child = genvarname(var_name);
eval([data_child ' = omniSUB{i}']);
end
but I don't know how to put them together to do that operation. Please correct me.
I appreciate your help.
Thanks in advance
4 Comments
Direct link to this comment
https://in.mathworks.com/matlabcentral/answers/497661-how-to-extract-sub-matrices-from-a-big-matrix#comment_780085
Direct link to this comment
https://in.mathworks.com/matlabcentral/answers/497661-how-to-extract-sub-matrices-from-a-big-matrix#comment_780085
Direct link to this comment
https://in.mathworks.com/matlabcentral/answers/497661-how-to-extract-sub-matrices-from-a-big-matrix#comment_780256
Direct link to this comment
https://in.mathworks.com/matlabcentral/answers/497661-how-to-extract-sub-matrices-from-a-big-matrix#comment_780256
Direct link to this comment
https://in.mathworks.com/matlabcentral/answers/497661-how-to-extract-sub-matrices-from-a-big-matrix#comment_780267
Direct link to this comment
https://in.mathworks.com/matlabcentral/answers/497661-how-to-extract-sub-matrices-from-a-big-matrix#comment_780267
Direct link to this comment
https://in.mathworks.com/matlabcentral/answers/497661-how-to-extract-sub-matrices-from-a-big-matrix#comment_780271
Direct link to this comment
https://in.mathworks.com/matlabcentral/answers/497661-how-to-extract-sub-matrices-from-a-big-matrix#comment_780271
Sign in to comment.