Hi, I'm trying to write a code where I have image files in my UITable (all listed in column 1) and I would like to have a save all image on my menu bar. What I'm having trouble with is finding a way to call all the images listed in my UITable and running those listed images again and save each image under an updated filename in a new folder.
Here is what I have so far:
filter = {'*.jpg';'*.png';'*.tif';'*.pdf';'*.eps'};
[filename,filepath] = uiputfile(filter);
app.UITable.Data = [app.UITable.Data;app.EDUcolorDATA];
filepath = app.UITable.Data{:,1};
h=1;
while h<=length(filepath)
close all
img = imread(filepath{h,1});
EDUInitialThresholding
mask = 100./app.mask;
EDUThresholdRefining
[pathstr,name,parts] = fileparts(filepath{h,1});
newname = sprintf('%s_processed', name);
newname1 = [name, parts];
if ischar(newname1)
exportgraphics(figure(1),[filepath newname1]);
end
h=h+1;
end
When I run this code, I encounter an error where img = imread(filepath{h,1}); Error: Brace indexing is not supported for variables of this type.
How would I go about looping each image file I have, then running my algorithm and saving each image file with an updated name?
0 Comments
Sign in to comment.