access file from ext. hdd

Hi,
How to access a file from external hard disc ?
for example from, "/media/ext_hdd/"
Mahesh

回答 (2 件)

Jan
Jan 2014 年 1 月 1 日

0 投票

This works directly, e.g.:
FID = fopen('/media/ext_hdd/YourFile.ext', 'r')
This works exactly as for files on the internal disk. So please explain, what you have tried and which problems occur.

5 件のコメント

ektara
ektara 2014 年 1 月 2 日
my path is like....
fid=fopen('/media/WD\ Passport/r16_eraint_output/rmed16_etp1_newmask_noatlantic.nc')
and give me -1
and can't access.
Walter Roberson
Walter Roberson 2014 年 1 月 2 日
Is the backslash part of the path? Or are you attempting to "escape" the space? If you are attempting to "escape" the space then leave out the backslash. "escaping" a space is needed by shells but is not used at the fopen() level.
Also it is a good idea to indicate the access type you want, 'r' or 'w' or 'a'
Dora de Jong
Dora de Jong 2021 年 3 月 22 日
編集済み: Walter Roberson 2021 年 3 月 24 日
I also have problems with uploading the files from my harddisk.
addpath('D:\AHN3\DSM05');
filelist = dir('DSM05');
But filelist gives a empty 0x1 structure.
When I use a folder intern it works, but not when I use a folder from the harddisk D. I use windows.
Walter Roberson
Walter Roberson 2021 年 3 月 24 日
dir() does not use the search path. But you can use
projectdir = 'D:\AHN3\DSM05';
filelist = dir(projectdir);
Jan
Jan 2021 年 3 月 24 日
It is a bad programming practize to call addpath to append a folder containing data files. Include only folders in the Matlab path, which contain your M-files.
To get a list of files:
filelist = dir('D:\AHN3\DSM05');

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

Larry B
Larry B 2019 年 5 月 24 日

0 投票

I wanted to access data files on a external drive named "My Passport" in matlab using my MAC. The following is example of the path layout for the filename to make that happen:
fname ='/Volumes/My Passport/Tower_Collect/201808B.raw';
The data was successfully loaded and processed

カテゴリ

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

タグ

質問済み:

2014 年 1 月 1 日

コメント済み:

Jan
2021 年 3 月 24 日

Community Treasure Hunt

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

Start Hunting!

Translated by