H5L.iterate exception and behavior of native matlab functions() method
Afficher commentaires plus anciens
Hello,
I'm developing a wrapper to use hdf5 files via set of low-level [+H5(?)] packages, provided my Matlab. As a part of this project I need to use H5L.iterate method, that has the following signature:
[status idx_out opdata_out] = H5L.iterate(group_id,index_type,order,idx_in,iter_func,opdata_in)
where iter_func is a pointer to a callback function that is supposed to be used on every step of iteration.
The H5L.iterate method is called inside a general class (let's say hdf5Adapter), so I would like to use a handle to another method of hdf5Adapter as [iter_func] argument for H5L.iterate.
However when doing so I receive an exception thrown by H5L.iterate caused by the following validation inside H5L.iterate (%matlabroot\toolbox\matlab\imagesci\+H5L\iterate.m) :
f = functions(iter_func);
if isempty(f.file)
error(message('MATLAB:imagesci:H5:badIterateFunction'));
end
because f.file appears to be empty.
I have tested the behavior of functions() method when applied to class methods (example below) and it seems to return empty 'file' field in the return data structure. See the test class definition in the attachment.
The way I test it:
foo = tstClass();
disp('instance method, as object');
ifhi = @foo.testFuncInstance; % instance method, as object
disp(functions(ifhi));
disp('instance method, as class');
cfhi = @tstClass.testFuncInstance; % instance method, as class
disp(functions(cfhi));
disp('static method, as object');
ifhs = @foo.testFuncInstance; % static method, as object
disp(functions(ifhs));
disp('static method, as class');
cfhs = @tstClass.testFuncInstance; % static method, as class
disp(functions(cfhs));
My questions are the following:
- Is there any way to make the result struc of functions(handle_to_class_method) to have a non-trivial 'file' value?
- What is the purpose of the check 'if isempty(f.file)' in H5L.iterate?
Thank you, Maxim Semyonov
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Functions dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!