Effacer les filtres
Effacer les filtres

I want to set a .CSV file as a datastore, and then set the fifth and the fourth columns as predictors, and the third column as the target.

2 vues (au cours des 30 derniers jours)
I want to designate a CSV file as a data store. Then I want to transform the 5th and the 4th columns as predictors to my neural network. The third column is also my target. Finally, I want to combine them in one datastore to feed them to my network. the code should be like this:
(This one is for a .MAT file)
folderTrain = fullfile(outputFolder,"Train");
fdsTrain = fileDatastore(folderTrain, ReadFcn=@load);
tdsPredictorsTrain = transform(fdsTrain, @(data) {data.X(1:2,:)});
preview(tdsPredictorsTrain)
tdsTargetsTrain = transform(fdsTrain, @(data) {data.Y});
preview(tdsTargetsTrain)
cdsTrain = combine(tdsPredictorsTrain,tdsTargetsTrain);
But, I can't do it with another .CSV file. The following is my code:
fdsTest = fileDatastore("C:\Users\\Desktop\Reading Material\Term 3\BDSD Minor\HAN Battery\Archive 3\25degC LFP.csv", ReadFcn=@load);
tdsPredictorsTest = transform(fdsTest, @(data) {data((5),data(4))});
  1 commentaire
dpb
dpb le 22 Nov 2022
W/O the format of the csv file, there's very little (as in nothing) anybody here can do...you didn't even tell us what happened, error messages, nothing...
But, I'd be highly suspect of |
fdsTest = fileDatastore("C:\Users\\Desktop\Reading Material\Term 3\BDSD Minor\HAN Battery\Archive 3\25degC LFP.csv", ReadFcn=@load);
using load. load has a bad habit of returning different types of result variables depending upon the form of the input file. Use readmatrix or somesuch to control the input.
I'd be suspect you really need the complexity of a datastore besides -- how big is this file?

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur Logical dans Help Center et File Exchange

Produits


Version

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by