필터 지우기
필터 지우기

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 (최근 30일)
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
dpb
dpb 2022년 11월 22일
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?

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

제품


릴리스

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by