I have 41 images. when I binarize it, then I plot 41 images in one figure as shown below. My coding as below. How to extract it into their own. I mean I want to save as png. Im used imwrite but failed.
DATASetDir = fullfile('C:\Users\Akmal\Desktop\I-131 256 28.02.2020\I-131 SPECT NEMA VALIDATION 01112019 256X256 26.09.2021 petang');
IMAGEDir = fullfile(DATASetDir,'Test');
IMDS = imageDatastore(IMAGEDir);
[C,scores] = semanticseg(I,net1);
imwrite(outt22(:,:,k), sprintf('%d.png', k));
this is my error
Index in position 3 exceeds array bounds (must not exceed 1).
only first image saved, the rest 40 image not have.
ANYONE CAN HELP ME? SHOULD BE CAN SAVE 41 IMAGES BINARY IMAGES.