For loop error in App Designer
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
승곤 유
el 14 de Mayo de 2022
Respondida: Image Analyst
el 14 de Mayo de 2022
1. image add button
global k;
global str2num;
file=uigetfile('*.*', 'select a single file at a time', 'download', 'MultiSelect','on');
k=length(file);
str2num();
2. filter button
global k;
for q = 1:k
c = char((file(q)));
imagec = imread(c);
imagec_=imagec(:,:,1);
mask=[-1 -1 -1; -1 9 -1;-1 -1 -1];
sharp_imagec_=imfilter(imagec_,mask);
imgchange(:,:,1)=sharp_imagec_;
imwrite(imgchange,strcat('gray',num2str(q),'.jpg')); %%각각 이미지를 저장
end
The above code is written in the app designer. The problem is that on execution, c = char((file(q))); This is where the double-type problem occurs. Script works fine, but App Designer doesn't.What can I do to fix it?
0 comentarios
Respuesta aceptada
Image Analyst
el 14 de Mayo de 2022
file is not in scope in your second button. You can make it a global variable by attaching to the app structure so in the first "add" function, or by using the global keyword
app.file=uigetfile('*.*', 'select a single file at a time', 'download', 'MultiSelect','on');
k=length(app.file);
then in the second "filter" function use app.file
c = char((app.file(q)));
0 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Downloads en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!