save a cell to h5 file in matlab
8 views (last 30 days)
Show older comments
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
0 Comments
Answers (0)
See Also
Categories
Find more on Call Python from MATLAB in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!