How do I write a function that contain a for loop to go through my filesname to find a match?
Show older comments
I currently collected a set of "name_list" together with a set of "numoflikes_list". Each name has certain num of likes attached to it. (i.e 123456789.jpg, 345 likes; 1432546435.jpg, 23 likes)
And I would like to write a function that go through all my image_name in a folder to find a match with the "name_list" that I have collected and eventually obtaining the num of likes that is associated with my image name.
This is what I have so far, was stuck and not sure how to write the for loop for this function:
function numofLikes=get_num_of_likes(image_name,name_list,numoflikes_list)
for i=1:size(name_list, 1)
name_list{i}
Answers (1)
Thorsten
on 29 Oct 2015
It a one-liner; your probably do not want to write a function for it
nol = numoflike_list(strcmp(image_name, name_list));
9 Comments
Josephine Ng
on 29 Oct 2015
Josephine Ng
on 29 Oct 2015
Josephine Ng
on 29 Oct 2015
Josephine Ng
on 29 Oct 2015
Thorsten
on 30 Oct 2015
You don't Need a for loop, just use the line I've posted above.
Josephine Ng
on 2 Nov 2015
Thorsten
on 4 Nov 2015
E must be 1 x N or N x 1.
Categories
Find more on Deep Learning Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!