fast initialization of cell array of strings mex
Show older comments
I'm looking to initialize a cell array of strings in mex as quickly as possible from a long array of characters with an additional array of the locations of starts and stop from which to grab the strings. Any tips on ways of doing this quickly in Matlab?
I am planning on doing roughly the following:
- intialize with mxCreateCellArray
- initialize a cell with empty values using mxCreateCharArray - I think that using an empty value will prevent any initialization overhead. It would also be great if I could create a bunch of mxArray headers quickly in matlab without having to call a function for each one.
- populate the cell data (string value) using string data that is 2 bytes per character and using mxSetData,mxSetM,mxSetN - here it seems that a smart memory allocator would allow initializing a large block of memory and then breaking it into smaller chunks, rather than individually requesting memory from the OS for each string
2 Comments
Jim Hokanson
on 22 Nov 2016
James Tursa
on 22 Nov 2016
See comments about using mxCreateUninitNumericMatrix below.
Accepted Answer
More Answers (0)
Categories
Find more on MATLAB Compiler SDK in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!