Filter löschen
Filter löschen

save a cell to h5 file in matlab

8 Ansichten (letzte 30 Tage)
Georges Murr
Georges Murr am 6 Mai 2021
Bearbeitet: Georges Murr am 7 Mai 2021
How can I save a 1x2000 cells with each cell is a 21x512 matrix into a h5 file in matlab ? It saves all the cells as 1x2000 double and all of them are zeros. I want to save the cells in h5 file to use it in python, if there is another way to do it please let me know, appreciate your help.
for i = 1:length(idxtrain)
x_train{i} = img_array_prec{idxtrain(i)}(:,:,1);
end
%%
for i = 1:length(idxtest)
x_test{i} = img_array_prec{idxtest(i)}(:,:,1);
end
%%
savefileh5 = 'traintest.h5'
%%
try
h5create(savefileh5,'/train/x_train',[size(x_train,1) size(x_train,2)]);
h5write(savefileh5,'/train/x_train',x_train);
catch ME
warning('File already in folder');
end
%%
x_train1 = h5read(savefileh5,'/train/x_train'); %it gives double

Antworten (0)

Kategorien

Mehr zu Call Python from MATLAB 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