フィルターのクリア

alway get an error when i use a load command

3 ビュー (過去 30 日間)
Ray
Ray 2015 年 12 月 8 日
回答済み: Image Analyst 2015 年 12 月 8 日
% i made sure that the .mat files are in the same directory the myFolder directory specified below. The code was working fine but i upgraded the software to 2015b. Is this a problem?
myFolder = '/Volumes/MY PASSPORT/redhwan/Documents/MATLAB/2DimenstionalTestingGT20150907/MeasurementDataFinal/TWDPN5db14ft_35inchMetalCab'
load('xpositions.mat');
load('ypositions.mat');
Error using load
Unable to read file 'xpositions.mat'. No such file or directory.
Error in Plot2D (line 19)
load('xpositions.mat');

回答 (3 件)

Image Analyst
Image Analyst 2015 年 12 月 8 日
Use fullfile():
fullFileName = fullfile(myFolder, 'xpositions.mat');
load(fullFileName);
I strongly recommend you don't use cd to change directory and just create the full file name using fullfile() instead. Why? See the FAQ : http://matlab.wikia.com/wiki/FAQ#Where_did_my_file_go.3F_The_risks_of_using_the_cd_function.

Daniel LaCroix
Daniel LaCroix 2015 年 12 月 8 日
Just making a string variable with the folder the files are in doesn't help. You need to actually change the directory in MATLAB. You can do this with the cd command. However, if the program isn't in that folder you may get problems when you change the directory.
Another idea is to put the full file path in the load command, like this: load('/Volumes/MY PASSPORT/redhwan/Documents/MATLAB/2DimenstionalTestingGT20150907/MeasurementDataFinal/TWDPN5db14ft_35inchMetalCabxpositions.mat')

Geoff Hayes
Geoff Hayes 2015 年 12 月 8 日
Ray - if the two mat file are in the directory /Volumes/MY PASSPORT/redhwan/Documents/MATLAB/2DimenstionalTestingGT20150907/MeasurementDataFinal/TWDPN5db14ft_35inchMetalCab, then verify that this directory has been added to the MATLAB search path. Use the path function to view the search path.

カテゴリ

Help Center および File ExchangeSearch Path についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by