How to split data of a .mat file into trainH trainY testH testY as shown in picture

2 Ansichten (letzte 30 Tage)
  8 Kommentare
Benjamin Thompson
Benjamin Thompson am 9 Mär. 2022
You will need to post your dataset and more comments about what you want to do in order for the Community to offer a helpful answer.
uma
uma am 9 Mär. 2022
Bearbeitet: Stephen23 am 10 Mär. 2022
I have a .mat file dataset containg four variables trainH trainY...as you can see in the above picture. Now want these fours variables in another dataset in the same way...may be this is done in the CSV file.
I have attached both my .csv and .mat dataset I just want something like this
struct with fields:
trainH: [1000×9 double]
trainY: [1000×1 double]
testH: [473×9 double]
testY: [473×1 double]

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Arif Hoq
Arif Hoq am 9 Mär. 2022
My guess:
1st step: load your cmc.mat file in Variable A as a struct.
2nd step: extract your 4 variables from struct A.
A=load('cmc.mat');
trainH=A.trainH ;
trainY=A.trainY;
testH=A.testH;
testY=A.testY;
  9 Kommentare
Arif Hoq
Arif Hoq am 14 Mär. 2022
move your mouse cursor to the variable trainH.
Right Click > save as> write your fileName (cmc)>save
uma
uma am 14 Mär. 2022
Thank you so much. It was just to do drag and drop

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Workspace Variables and MAT-Files finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by