Extract cell rows to new array after strfind or strcmp matching.
Hi everyone,
I have an array of data (500*7) and the 7th column is a series of date array, they are all in random order so I would like to rearrange by month_array. So for each cell matching the portion of string ’01/2015′ i want a loop that extract the all rows (1:7) for example and store it in a new array etc.
I have included a picture to ease the understanding.
jan_table = [];
for i=1:size(ship_table);
idx = strfind(ship_table(i,7),’01/2015′);
if idx isequal(‘4’)
STORE ROW IN NEW ARRAY jan_table
else
jan_table = [jan_table num2cell(ships_table{i})];
end
end
If anyone could help, thanks!Hi everyone,
I have an array of data (500*7) and the 7th column is a series of date array, they are all in random order so I would like to rearrange by month_array. So for each cell matching the portion of string ’01/2015′ i want a loop that extract the all rows (1:7) for example and store it in a new array etc.
I have included a picture to ease the understanding.
jan_table = [];
for i=1:size(ship_table);
idx = strfind(ship_table(i,7),’01/2015′);
if idx isequal(‘4’)
STORE ROW IN NEW ARRAY jan_table
else
jan_table = [jan_table num2cell(ships_table{i})];
end
end
If anyone could help, thanks! Hi everyone,
I have an array of data (500*7) and the 7th column is a series of date array, they are all in random order so I would like to rearrange by month_array. So for each cell matching the portion of string ’01/2015′ i want a loop that extract the all rows (1:7) for example and store it in a new array etc.
I have included a picture to ease the understanding.
jan_table = [];
for i=1:size(ship_table);
idx = strfind(ship_table(i,7),’01/2015′);
if idx isequal(‘4’)
STORE ROW IN NEW ARRAY jan_table
else
jan_table = [jan_table num2cell(ships_table{i})];
end
end
If anyone could help, thanks! strfind, strcmp, extract cell to new array MATLAB Answers — New Questions