Extract matching row from another cell array
Mostra commenti meno recenti
I have attached 2 mat-files named all_files.mat and full_details.mat
Each row in all_files.mat has a row as shown in image below

I wanted to separate it into 3 parts as shown in yellow, green and blue
I have written a code below to separate it into 3 parts into str1, str2 and str3
load all_files
for i = 1
temp = all_files{i};
kdash = strfind(temp,'_');
kdot = strfind(temp,'.');
str1 = temp(1:kdash(1)-1);
str2 = temp(kdash(1)+1:kdash(2)-1);
str3 = temp(kdash(2)+1:kdot(1)-1);
end
load full_details
Now I wanted to get the row from full details which satisfies the below condition,
str1 matches the string in column1_of_full_details &&
str2 matches column2_of_full_details &&
str3 matches column3_of_full_details &&
column7_of_full_details == 'English'
If does not exist go to the next row in all_details
There will be many rows satisfying this condition. So I would like to get the row with the longest description, that string in column8_of_full_details
and save the row from all_files and the description from full_details
For example, if
temp = 'mv89psg6zh4_33_46.avi';
After the satisfying the 4 conditions, my result would be (Please Note: The below output has more rows. For understanding I have displayed only 3 rows)

and then I would like to get the longest string from the last column and save it along with all_files in a new variable as
Please could someone help to to do the condition check with more than 1 condition and to find the longest string from a column
1 Commento
load https://www.mathworks.com/matlabcentral/answers/uploaded_files/1350039/all_files.mat
Risposta accettata
Più risposte (0)
Categorie
Scopri di più su Cell Arrays 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!