I want to save a LUA table as a MAT file. Structure of Table is as follows:
{
1 :
{
bounding_box :
{
1 : 0.5
2 : 0.5
3 : 704.5
4 : 1280.5
}
PatchName : "03952.jpg"
confidence :
{
1 : 0.99999818651222
2 : 1.8134877758073e-06
}
}
2 :
{
bounding_box :
{
1 : 45.5
2 : 159.5
3 : 132.5
4 : 216.5
}
PatchName : "03953.jpg"
confidence :
{
1 : 0.99999864618192
2 : 1.3538180818906e-06
}
}
}
Can anybody guide me how to do that ?
I tried matio.save(string of path, table to save) but it returned following error:
bad argument #1 to 'varCreate' (cannot convert 'number' to 'const char *')
stack traceback:
[C]: in function 'varCreate'
/home/khurram/torch/install/share/lua/5.1/matio/init.lua:136: in function '__make_var'
/home/khurram/torch/install/share/lua/5.1/matio/init.lua:78: in function '__make_var'
/home/khurram/torch/install/share/lua/5.1/matio/init.lua:78: in function '__make_var'
/home/khurram/torch/install/share/lua/5.1/matio/init.lua:434: in function 'save'
main.lua:171: in main chunk
[C]: in function 'dofile'
[string "_RESULT={dofile('main.lua')}"]:1: in main chunk
[C]: in function 'xpcall'
/home/khurram/torch/install/share/lua/5.1/trepl/init.lua:651: in function </home/khurram/torch/install/share/lua/5.1/trepl/init.lua:560>
[string "require('trepl')()"]:1: in main chunk
Install and use https://github.com/soumith/matio-ffi.torch, e.g.:
local matio = require "matio"
matio.save("archive.mat",{foo="bar", scm="git"})