How can I open a file from different directories with a standalone application?

조회 수: 3 (최근 30일)
Hi,
I have a standalone exe made using MATLAB. This exe reads UFF files (not defined in MATLAB), and plots them.
Problem is:
This exe can only open UFF files located in the same directory of exe. When I try to open an UFF file in different folder (say C:\folder\testing.UFF)**, it only gets the filename (I use uigetfile) and plots nothing - reads noting. (Because there is no file with that name (testing.UFF) in the exe's location.)
I want to read that file, whereever it is!

채택된 답변

Image Analyst
Image Analyst 2013년 5월 3일
folder = 'C:\folder\';
baseFileName = 'testing.UFF';
fullFileName = fullfile(folder, baseFileName);
if exist(fullFileName)
% Open the file however you do
else
% File does not exist.
warningMessage = sprintf('%s does not exist', fullFileName);
uiwait(warndlg(warningMessage));
end
  댓글 수: 1
Ozan Oguz
Ozan Oguz 2013년 5월 3일
편집: Ozan Oguz 2013년 9월 6일
All the thing was using FULLFILE. And I didn't know that it was possible to use full path inside FOPEN command (I am using fopen).
Thank you!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Audio and Video Data에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by