how to call matlab file to another matlab file
i am working on simulation of power system using matlab. for that i
have written codes for generation side and line side separately. Now i
want to use the result of generation file to line file....so how can i
use the result of one file to another....
eg i have gen.m file from that i can get hourly gen data....now i want
to compare that data to line.....and line modelling is done in
separate file line.m so i want to call result of gen.m file to line.m
waiting for ur valuable suggestion
...methods to call matlab in C C++ and call C C++ in matlab
I am reading the help documents about how to program matlab and C C++ together and my questions are a little bit general.
It seems that are several ways to call matlab in C C++ and another several ways to call C C++ in matlab. Please correct me if I am wrong or missing something when I try to list them.
To call matlab code in C C++, are there two methods available? The first one is Matlab engine and the second one is to use MATLAB Compiler mcc to create C or C++ shared libraries from your MATLAB code.
To call C C++ in matlab, are there also two methods? The first one is to call funct...pass 3D Matrix from matlab to C mex- file
how can i pass 3d matrix from matlab to c
using mex file
> help please
> how can i pass 3d matrix from matlab to c
> using mex file
This is a mailing list for the Python programming language. Please ask your
question on the appropriate Matlab mailing list.
"I have come to believe that the whole world is an enigma, a harmless enigma
that is made terrible by our own mad attempt to interpret it as though it had
an underlying truth."
-- Umberto Eco
...How to pass complex structure from matlab to C++ mex file?
I want to pass a Matlab structure (called 'para') to a C++
mex file 'gateway.mex'. The fields of the structure can be
complex, numeric or a string. The data type of the field are
para.fieldname1 is a numeric
para.fieldname1 is a string
para.fieldname1 is a complex number
In the mex file (called by gateway(para)) I write something
like this to get the values of the different fields.
To get the numeric field :
tmp = mxGetField(prhs,0,fieldname1);
To get the string field:
tmp = m...Pass a 3d matrix from matlab to C mex file
please i need help
how can i pass a 3d matrix from matlab to C mex file
Its the same as passing in a 2D matrix. You can get
individual elements like:
void mexFunction(int nlhs, mxArray *plhs, int nrhs, const
double * pData;
mwSize * pSize;
nDims = mxGetNumberOfDimensions(prhs);
pSize = mxGetDimensions(prhs);
pData = mxGetPr(prhs);
//Then to get element at equivilent Matlab index (r,c,d)
DesElement = pData[r-1 + (c-1)*pSize + (d-1)*pSize
"Bavi b...Segmentation violation after calling mex c file in matlab
i'm new in calling C file whitin matlab.
I wrote a c function called intex :
double* intex(double *zrd_a, int dim_of_matrix, double delta_t, int
fa, int is_phi_h);
and its mexFunction in C.
As you can see, i read the matrix "zrd_a" to calculate and give as
output another matrix.
The problem is after calling the C method a certain time (5 or 10
times), Matlab craches and show the following error:
Segmentation violation detected at Tue Dec 12 12:15:55 2006
-----------------------------...[C file I/O (via mex)] content written to file is only present if matlab is closed
I have c-function interfaced via mex.
Inside this function several file streams are opened, content is
written using fprintf() and the files are closed.
Some file descriptors are defined within the function scope,
opened there, written there and closed there.
With these files all is fine.
But one file descriptor is declared globally, opened in one function,
written to in another and finally closed in the function, where it
has been opened.
The problem with this file is, that after a successful call of the
mex function, the file size is 0 bytes.
The file is opened with "w" ...Problem creating Mex file when calling Matlab from C++; DLL
I have some MS Visual C++ 2008 code that is compiled using mex command into dlls; and the code is executed from Matlab 2010a. I now want to call some Matlab commands from within the C++ functions (to solve large complex linear equations/matrix inversion). From what I could read online and on the Matlab engine webpage, I will have to create an exe file rather than dll to call Matlab from C. I'm not familiar with either dlls or exes, and I am unable to compile the code correctly now. I get the error:
LINK : fatal error LNK1561: entry point must be defined
I will apreciate if s...Pass a 3d matrix from matlab to C mex file #2
please i need help
how can i pass a 3d matrix from matlab to C mex file
...I have a m-file that I compiled into a dll using MatLab compiler. I then created a C# library class to call the MatLab dll
>i creat an M-file which has an imagen in file then in matlab i create it dll using >deploytool
>Then i include this dll in visual studio 2005 C#.Net project
>Then i make a windows form which has a button,picturebox,textbox openfiledialog
>what should be the code of button it access the m-file from matlab show its path in >textbox and image in picture box or
>what is the procedure of accesing matlab file from C#.Net,plz help me for this >problem immediatley
>my code of m-file is
As a solution to some posts a while ago about reading compressed matlab
7 files in matlab 6, i posted load5 to the file exchange (7734) which
does this. Note that the "Other Requirements" field on the FX is
outdated as the zip file has both windows and linux versions and DOES
search the matlab path if the file is not found in the current
...C++ Mex file crashes matlab on 64bit linux, but not 32 bit windows, but program runs fine outside Matlab
I have written a mex gateway function to a C++ class. If I compile this mex function on 32Bit windows using R2008a I have no problems. If I compile and run on Matlab R2011a running 64bit Scientific Linux (a version of Red Hat Enterprize Linux) matlab exits with a segfault when the mexfunction is called, although it appears to run about halfway through the program. The C++ class can be compiled and run (with a main function) outside of Matlab on both platforms with no errors. I am using Microsoft Visual C++ Express Edition on the windows machine, and gcc 4.4.5 on the Linux machine.
...How do I call a subfunction fom a ".m" file in my matlab dir. with mexCallMatlab, C++ MEX
I am a beginner at MEX functions, and i have a big main program with a funtion like this:
I want to call this variable from my MEX function callded from the main ".m" file, and have tried to do this in the following manners:
mexCallMATLAB(1, properties, 0, NULL, "speedOfSound");
mxArray * Speedofsound=mexGetVariable("global", "pSettings.c");
Both choices gives me a errors...Is it possible to convert a matlab files into a .c files ?
hi i am fascinated about Is it possible to convert a matlab files into a .c files or python ?
is there any easy way for doing this ?
if yes please tell me how ???
"ofdma_matlab" wrote in message <firstname.lastname@example.org>...
> hi i am fascinated about Is it possible to convert a matlab files into a .c files or python ?
> is there any easy way for doing this ?
> if yes please tell me how ???
Hi, yes, see
to generate C or C++ code.