How to read data from another directory using dlmread function

I have two folders, A and B. The matlab code/program to be run is in A. I want to run this code and read data which is placed in B. The part of my script is written as:
myf3= '/home/habtamu/Desktop/data/XYZ/ABG,2012/B';
files3=dir(fullfile(myf3,'*.min'));
D = dlmread(files3(1).name,' ' ,26,7);
myf3 is the name of the path for folder B.When I run this, the error is generated as
Error using dlmread (line 122)
The file 'abg20120101dmin.min' could not be opened because: No such file or directory
Error in allin (line 53)
D = dlmread(files3(1).name,' ' ,26,7);
allin is the file name of my code. any solution please?

 採用された回答

Geoff Hayes
Geoff Hayes 2017 年 4 月 22 日

1 投票

Habtamu - the files3 structure only includes the names of the files and not the path to each one. You would need to read the file as
D = dlmread(fullfile(myf3,files3(1).name),' ' ,26,7);

1 件のコメント

Habtamu Wubie
Habtamu Wubie 2017 年 4 月 22 日
Thank you very much, it helped me great.

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

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeFile Operations についてさらに検索

タグ

質問済み:

2017 年 4 月 22 日

編集済み:

2017 年 4 月 24 日

Community Treasure Hunt

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

Start Hunting!

Translated by