Sun 14 Jun 2015 12:23:49 PM UTC, comment #1:
Update:
I've succeeded solution myself.
Code, attached at the end of this message works.
Unless I'm missing something here, the issue is interface inconsistency.
Namely, opening file for consequent HDF5 write should be done differently.
Regards,
Dmitry
#include <fstream>
#include <string>
#include <octave/oct.h>
#include <octave/octave.h>
#include <octave/toplev.h>
#include <octave/load-save.h>
#include <octave/parse.h>
#include <octave/ls-hdf5.h>
using namespace std;
typedef symbol_table::symbol_record OctaveSymbolRecord;
int main (int argc, char** argv)
{
auto A = ComplexNDArray(dim_vector(10,20));
OctaveSymbolRecord a_record = OctaveSymbolRecord(0, string("A"), octave_value(A));
hdf5_ofstream ofs(argv[1]);
if( ofs.file_id > 0 ) {
load_save_format fmt = load_save_format(LS_HDF5);
write_header(ofs, fmt);
do_save(ofs, a_record, fmt, false);
} else {
cerr << "ERROR: failed to open " << argv[1] << " for writing" << endl;
}
ofs.close();
return 0;
}
|