void writeTENSOR2file(TENSOR2 x,char *fname,char *varname,char *mode) { /* MODES: "r": Open file for reading only; determines the current version of the MAT-file by inspecting the files and preserves the current version. "u": Open file for update, both reading and writing, but does not create the file if the file does not exist (equivalent to the r+ mode of fopen); determines the current version of the MAT-file by inspecting the files and preserves the current version. "w": Open file for writing only; deletes previous contents, if any. */ mxArray *A; MATFile *fid; allocArrnCopy2(&A,x,1); fid = matOpen(fname,mode); matPutVariable(fid,varname,A); matClose(fid); mxDestroyArray(A); } void writeTENSOR3file(TENSOR3 x,char *fname,char *varname,char *mode) { mxArray *A; MATFile *fid; allocArrnCopy3(&A,x,1); fid = matOpen(fname,mode); matPutVariable(fid,varname,A); matClose(fid); mxDestroyArray(A); } void writeTENSOR4file(TENSOR4 x,char *fname,char *varname,char *mode) { mxArray *A; MATFile *fid; allocArrnCopy4(&A,x,1); fid = matOpen(fname,mode); matPutVariable(fid,varname,A); matClose(fid); mxDestroyArray(A); }