I have written a mex file to 1. Initialize hardware. 2. Get Data. 3. Close & Exit hardware.
—-Some_App.cpp—-
void mexFunction(parms){handle = init_hw();alloc_mem(handle);get_data();copy_to_mxDoubleMatrix();exit_hw(handle);}
This works fine.
I have to change it such a way that init_hw(); is in a different class. Using this handle, I need to be able to allocate_mem(handle), get_data()… say a 100 times, then exit_hw(handle); as the init_hw() takes long to run I don't want to init_hw() everytime.
Can I do something to separate them into classes and use like
handle = Some_App.init_hw();for i = 1:100 array = Some_App.acquire(handle); /*All Memalloc, read go into this class*/endSome_App.exit_hw(handle);
Any Tutorials/Help/Links can be useful. Thanks
Best Answer