file path issue in matlab

9 ビュー (過去 30 日間)
ali hassan
ali hassan 2022 年 1 月 27 日
コメント済み: ali hassan 2022 年 1 月 28 日
i have made a GUI and i am using:
iugetfile('filename')
to select the file but if the file is not present in MATLAB path, the GUI does not load that file. But if the file is in the MATLAB path,only then it works.
kindly tell me a solution by using which it does not give path error when i load any file using my GUI.
  2 件のコメント
Rik
Rik 2022 年 1 月 27 日
The uigetfile function should open a dialog box. If the user closes it without selecting a file, the result is 0.
What actual error are you getting?
ali hassan
ali hassan 2022 年 1 月 27 日
Unable to find or open '111..txt'. Check the path and filename or file permissions.

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

採用された回答

DGM
DGM 2022 年 1 月 27 日
uigetfile() doesn't do anything but return a filename. It doesn't matter where the file is or whether it's on the ML path. It just returns text.
If you aren't getting the full path information for the selected file, or are otherwise not using it whenever you try to read said file, then that's where your problem is.
[filename pathname] = uigetfile('*.png','select an image file')
A = imread(fullfile(pathname,filename));
  1 件のコメント
ali hassan
ali hassan 2022 年 1 月 28 日
thankyou @DGM

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeFile Operations についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by