Hi guys,
I have a small Problem with storing a Vector as CSV-File using a mex function. I my goal is an nice and tidy implementation. For that reason I tried the following code:
mdlStart FILE *PtrTextID = ssGetPWork(S,3); PtrTextID = fopen("Storage.txt", "w");mdlUpdate FILE *PtrTextID = ssGetPWork(S,3); fprintf(PtrTextID, "Test");mdlTerminate FILE *PtrTextID = ssGetPWork(S,3); fclose(PtrTextID);This code leads to a Matlab crash. But if I'm using mdlUpdate FILE *PtrTextID PtrTextID = fopen("Storage.txt", "w"); fprintf(PtrTextID, "Test"); fclose(PtrTextID);
the code works pretty well and do the thinks it's used to. Thats why my guess is that ssGetPWork is not the right workspace to store an FILE-Structure. But what is the right Workspace?
Thanks for your help, CN CN
Best Answer