필터 지우기
필터 지우기

selecting a text file from a work directory

조회 수: 2 (최근 30일)
hasan alhussaini
hasan alhussaini 2018년 5월 2일
답변: Image Analyst 2018년 5월 2일
Hello! i'm quite new to matlab. i've got the following code
[pos_file,workdir] = uigetfile({'*.jpg;*.tif;*.png;*.gif;.txt*','All Image Files';... '*.*','All Files',},'Select the text files(s)','MultiSelect', 'on'); the code above lets me select a code manually, by selecting it. it works great but it is tiring.
i'm trying to be more efficient, i want my code to automatically select the txt file without me selecting it manually, the file is called "Posi" and it is a txt file.
and it lays in the work directory, which is saved as workdir

답변 (2개)

Ameer Hamza
Ameer Hamza 2018년 5월 2일
The function of uigetfile is to return the name of the selected file. If you already know the name of the file, you don't need uigetfile. Remove the line and replace it with
pos_file = 'Posi.txt';

Image Analyst
Image Analyst 2018년 5월 2일
Use fullfile:
pos_file = fullfile(workdir, 'Posi.txt');
then call csvread(), importdata() or whatever you do.

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by