I have already the solution, the way is the next:
Create a .m file (for example SaveWorskpace.m) con this information:
save test.mat
Add SaveWorskpace.m at the project with Matlab Compiler Deployment Tool.
- Compile the project with Matlab Compiler Deployment Tool
- Add reference at the c# project
- Call function SaveWorkspace()
- Ready, you have variables save in the workspace test.mat