How do I define an input folder to execute and build a standalone application in MATLAB?

1 回表示 (過去 30 日間)
The Imagician
The Imagician 2016 年 11 月 3 日
編集済み: Jan 2016 年 11 月 4 日
I have defined a folder to read my input images from in my matlab code. How do I change this if I am to build my program into a standalone application? Because, now when I run the .exe file my program doesn't run as expected, which I'm guessing is due to this. Can someone help?
% Define path to folder with images to processs
Dir = 'C:\Users\username\Documents\MATLAB\FolderwithImages';
% % Read images from Images folder
Images = dir(fullfile(Dir, '*.tif'));
for r=1:length(Images)
<<algorithm>>
end
  1 件のコメント
Jan
Jan 2016 年 11 月 4 日
Please explain, why you guess, that the shown code contains the problem. At least I cannot reconsider this.

サインインしてコメントする。

回答 (1 件)

Jan
Jan 2016 年 11 月 4 日
編集済み: Jan 2016 年 11 月 4 日
The shown code does not contain a problem. Perhaps you forgot to include the path when opening the image files.
Dir = 'C:\Users\username\Documents\MATLAB\FolderwithImages';
Images = dir(fullfile(Dir, '*.tif'));
for r=1:length(Images)
ImageFile = fullfile(Dir, Images(r).name);
<<algorithm>>
end
It might be smarter to get the fiolder using uigetfolder and perhaps store the last used folder as preferences for the next run.

カテゴリ

Help Center および File ExchangeStandalone Applications についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by