How to use dlmread with a txt file not in Matlab directory?

2 ビュー (過去 30 日間)
Nuno
Nuno 2011 年 10 月 6 日
Hi,
I'm using this piece of code to read from a .txt file but it can only read files that are in the directory of the script... How can i read a file located in another directory? i don't want to use the import wizard since the data in .txt file is always the same and with the same length... Also i want to build a standalone app so i want it to be as simple as i could be.
[filename2, pathname2] = uigetfile( ...
{'*.txt;', 'All Files (*.*)'}, ...
'Select the file');
handles.filename = filename2;
handles.pathname = pathname2;
x_i=dlmread(filename2, '\t',[1 0 39 0]);
fi=dlmread(filename2, '\t',[1 1 39 1]);
fi_theta=dlmread(filename2, '\t',[1 2 90 2]);
Lmean=dlmread(filename2, '\t',[1 3 1 3]);
Thanks

採用された回答

Grzegorz Knor
Grzegorz Knor 2011 年 10 月 6 日
x_i=dlmread(fullfile(pathname2,filename2), '\t',[1 0 39 0]);
  1 件のコメント
Nuno
Nuno 2011 年 10 月 6 日
Thanks for the help!

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

その他の回答 (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