h5read takes longer time when called inside a function compared to console call

조회 수: 3 (최근 30일)
Hello,
I've noticed, h5read function to read HDF5 format takes longer time when called inside a function (at least my own function) compared to console call.
For example, I call the following command inside my function and it takes around 2.5 seconds, linearly dependent on the amount of elements I am calling of course;
colinearIMG = h5read('./temp/IMG.h5','/colinearIMG', [1 1 idxVec{j}(l)+1], [zL xL iterVec{j}(l)]);
Here, idxVec and iterVec simply determine my starting point and how many matrices I am going to load into RAM. These numbers do not vary much, (for example they stay 100 for the most time and just change to other numbers twice during whole process). zL and xL are simply 1201 and 1001 respectively but I don't think it would make much difference.
When I call the same line in console however, it takes around 0.5 seconds, 5 times faster!
colinearIMG = h5read('./temp/IMG.h5','/colinearIMG', [1 1 500], [1201 1001 100]);
I have around 16 to 32 GB's of datasets that I'd like to call partially for my project. I specifically create the dataset and save it somewhere beforehand so that I don't have to try to create it on the fly and have slower code/out of memory issues but I also do not want my code to be bottlenecked by reading the dataset as well.
What may be the reason for this? What am I doing wrong?

답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by