I'm very new to Matlab, so I'm sorry if this is too basic... I'm trying to figure out how to save all specified frames of a video (I usually don't have only 4 frames; I have more than 100...), giving them different names, preferable containing either the b variable corresponding to that loop or the corresponding frame number. How do I introduce that in the "imwrite..." line below? The way it is written now, it only saves the last frame, of course...
filename=horzcat(directory, '\', sdirectory(a).name);
filecheck=contains(filename,'.avi') && contains(filename, 'Lever', 'IgnoreCase', true);
imwrite(thisframe, [directory, '\', '.jpg']);