
Object Oriented Design É 321
y = mxGetPr(plhs[0]);
/* Call the C subroutine. */
trans(x,y,mrows,ncols);
}
Compile the file with,
>> mex trans.c
Now, if you give an input matrix y as:
>> y = [1,2,3;4,5,6;7,8,9];
>> trans(y)
ans =
1 4 7
2 5 8
3 6 9
Time for Practice 11.10
Based on these examples try to make a MEX code for finding out the conjugate transpose
of a matrix with complex numbers.
Note:
1. If there is a MEX-file and an M-file with the same name, the MEX-file gets preference over
the latter during execution.
2. It is not necessary to have a computational routine in every MEX-file; it is just a subroutine
which can be eliminated if there is no numeric ...