I have two sparse matrices, both rather large, which should be used as the input for my mex file.
It is no problem to do this with a full matrix but i want to avoid this due to the size of the matrices.
Thanks for helping me.
Direct link to this comment:
You can use sparse files directly as input to a mex function. There is e.g. the example code fulltosparse.c. So please explain, which problem you have. Maybe you want to convert the sparse format used by Matlab to a specific other format? Please mention the details.
Handling sparse matrices in C/C++ mex routines is tricky enough ... but in Fortran it is going to be even trickier due to the fact that it will be harder to work directly with the data pointers in Fortran. It can be done, but you will need to write Fortran code to convert the raw pointer values from the API routines (mxGetIr, mxGetJc, etc) to usable Fortran pointers first. What do you intend to do with these sparse matrices inside your mex function?
Sign in to comment.
Sign in to answer this question.
Opportunities for recent engineering grads.
Unable to complete the action because of changes made to the page. Reload the page to see its updated state.
Choose your location to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a location from the following list:
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.