User`s manual

Examples of MAT-Files
6-15
pa2 = matGetArray(pmat, "GlobalDouble");
if (pa2 == NULL) {
printf("Error reading existing matrix GlobalDouble\n");
return(EXIT_FAILURE);
}
if (!(mxIsFromGlobalWS(pa2))) {
printf("Error saving global matrix: result is not global\n");
return(EXIT_FAILURE);
}
pa3 = matGetArray(pmat, "LocalString");
if (pa3 == NULL) {
printf("Error reading existing matrix LocalDouble\n");
return(EXIT_FAILURE);
}
status = mxGetString(pa3, str, sizeof(str));
if(status != 0) {
printf("Not enough space. String is truncated.");
return(EXIT_FAILURE);
}
if (strcmp(str, "MATLAB: the language of technical
computing")) {
printf("Error saving string: result has incorrect
contents\n");
return(EXIT_FAILURE);
}
/* clean up before exit */
mxDestroyArray(pa1);
mxDestroyArray(pa2);
mxDestroyArray(pa3);
if (matClose(pmat) != 0) {
printf("Error closing file %s\n",file);
return(EXIT_FAILURE);
}
printf("Done\n");
return(EXIT_SUCCESS);
}