将jpg文件名添加到列表框中,然后选择一个用于观看的名称-Matlab



如何从该列表框中读取选定的jpg并在轴中查看它?

function selectFolderButtonPushed(app, event)
app.selectedPath = uigetdir();
jpgFileInfo = dir(fullfile(app.selectedPath, '*.jpg'));
app.jpgListBox.Items =  {jpgFileInfo.name}';
end

function loadimageButtonPushed(app, event)
imageSelected = imread(......);
imshow(imageSelected, app.imageAxes);
end

我希望它能有所帮助:

function SelectFolderButtonPushed(app, event)
app.selectedPath = uigetdir();
jpgFileInfo = dir(fullfile(app.selectedPath, '*.jpg')) 
app.jpgListBox.Items =  {jpgFileInfo.name}'; 
end

function loadimageButtonPushed(app, event)
selectedFileName = app.jpgListBox.Value;
selectedPath = app.selectedPath;
imageSelected =strcat(selectedPath, "", selectedFileName)
imshow(imageSelected,'Parent',app.imageAxes); 
end

相关内容

  • 没有找到相关文章

最新更新