How can i load file to train data for Sequence-to-Sequence Regression Using Deep Learning

3 views (last 30 days)
I have been trying this code from https://au.mathworks.com/help/deeplearning/examples/sequence-to-sequence-regression-using-deep-learning.html#SequencetoSeq to forecast multivariate timeseries data. But couldn't open the file to load the data and then train. Can anyone help me please
filenamePredictors = fullfile(dataFolder,"train_FD001.txt");
[XTrain,YTrain] = prepareDataTrain(filenamePredictors);
***MY CODE
filename = "C:\Users\Documents\Research\threevartest.txt ";
dataFolder = "data";
filenamePredictors = fullfile(dataFolder,"C:\Users\Documents\Research\threevartest.txt ");
[XTrain,YTrain] = prepareDataTrain(filenamePredictors);
function [XTrain,YTrain] = prepareDataTrain(filenamePredictors)
dataTrain = dlmread(filenamePredictors);
numObservations = max(dataTrain(:,1));
XTrain = cell(numObservations,1);
YTrain = cell(numObservations,1);
for i = 1:numObservations
idx = dataTrain(:,1) == i;
X = dataTrain(idx,3:end)';
XTrain{i} = X;
timeSteps = dataTrain(idx,2)';
Y = fliplr(timeSteps);
YTrain{i} = Y;
end
end
******************************Shows me error
Error using fopen
Unable to find file. Ensure file exists and path is valid.
Error in dlmread (line 60)
[fid, theMessage] = fopen(filename);
Error in twovartest1>prepareDataTrain (line 11)
dataTrain = dlmread(filenamePredictors);
Error in twovartest1 (line 7)
[XTrain,YTrain] = prepareDataTrain(filenamePredictors);

Answers (1)

Raunak Gupta
Raunak Gupta on 3 Dec 2019
Hi,
From the error message I can tell that dataset file is missing. So, first you may try to download data mentioned in Download Data . You need to save the data file in the directory where script is present and there are some helper function mentioned at the bottom of the example. Those should be saved as separate functions before calling full script.

Categories

Find more on Get Started with MATLAB in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!