error when im trying to save

Hi all.im trying to make a load short forecasting but in one of the steps i cant go on because of this error: *??? Error using ==> save Unable to write file Data\testSet: No such file or directory.*..could you help me?thanks

5 件のコメント

Thomas
Thomas 2012 年 6 月 3 日
could you show the snipet of your code where 'save' occurs
UPT
UPT 2012 年 6 月 3 日
thomas thanks for answering.
%% Split the dataset to create a Training and Test set
% The dataset is divided into two sets, a _training_ set which includes
% data from 2004 to 2007 and a _test_ set with data from 2008. The training
% set is used for building the model (estimating its parameters). The test
% set is used only for forecasting to test the performance of the model on
% out-of-sample data.
% Create training set
trainInd = data.NumDate < datenum('2008-01-01');
trainX = X(trainInd,:);
trainY = data.SYSLoad(trainInd);
% Create test set and save for later
testInd = data.NumDate >= datenum('2008-01-01');
testX = X(testInd,:);
testY = data.SYSLoad(testInd);
testDates = dates(testInd);
save Data\testSet testDates testX testY
clear X data trainInd testInd term holidays dates ans num text
??? Error using ==> save
Unable to write file Data\testSet: No such file or directory.
Walter Roberson
Walter Roberson 2012 年 6 月 3 日
You would get that error if you did not have a subdirectory named "Data" in your current directory.
Image Analyst
Image Analyst 2012 年 6 月 3 日
Your code would be more robust if you had a special folder for your data files and didn't mix your data files in with your m-files, fig files, and other files. Learn how to use uigetdir(), uigetfile(), fullfile(), exist(), and mkdir().
UPT
UPT 2012 年 6 月 3 日
thanks for your help,especially you walter roberson..

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

 採用された回答

Thomas
Thomas 2012 年 6 月 3 日

0 投票

try
save('testSet.mat','testDates', 'testX' , 'testY') %to save it in the current directory
or create a directory called Data and use
save('Data\testSet.mat','testDates', 'testX' , 'testY') % to save in Data dir
or just add the follwing in a line above the save command
mkdir('Data'); % this should create the data directory

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangePower and Energy Systems についてさらに検索

タグ

質問済み:

UPT
2012 年 6 月 3 日

Community Treasure Hunt

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

Start Hunting!

Translated by