selecting a text file from a work directory
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
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
0 Kommentare
Antworten (2)
Ameer Hamza
am 2 Mai 2018
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';
0 Kommentare
Image Analyst
am 2 Mai 2018
Use fullfile:
pos_file = fullfile(workdir, 'Posi.txt');
then call csvread(), importdata() or whatever you do.
0 Kommentare
Siehe auch
Kategorien
Mehr zu Environment and Settings finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!