How can i introduce a function in matlab?

I want introduce the function "mtimesx" in matlab but i don´t know how
I tried it since import file but i have errors
My version is r2008a and i have windows 7
thanks

댓글 수: 1

TAB
TAB 2013년 3월 12일
What do you mean by introduce a function ? Do you want to add function in matlab so it can be run from anywhere ?

댓글을 달려면 로그인하십시오.

 채택된 답변

Walter Roberson
Walter Roberson 2013년 3월 12일

0 개 추천

You will need to install a supported compiler; see http://www.mathworks.com/support/compilers/release2008a/
Then at the MATLAB command line, give the command
mex -setup
to select the compiler.
Then, download mtimesx and unzip it into a new directory under your Documents and Settings folder.
In MATLAB, "cd" to that folder and then at the MATLAB command line give the command
mtimesx_build
that should build the program.
After that you might possibly need to use pathtool to add the new directory to your MATLAB path.

추가 답변 (2개)

agustin darrosa
agustin darrosa 2013년 3월 15일
편집: Walter Roberson 2013년 3월 15일

0 개 추천

thanks but i have this problem
Build routine for mtimesx
... Checking for PC
... Finding path of mtimesx C source code files
... Found file mtimesx.c in C:\Program Files\MATLAB\R2008a\sys\lcc\mtimesx\mtimesx.c
... Found file mtimesx_RealTimesReal.c in C:\Program Files\MATLAB\R2008a\sys\lcc\mtimesx\mtimesx_RealTimesReal.c
... Opened the mexopts.bat file in C:\Users\Gusa\AppData\Roaming\MathWorks\MATLAB\R2008a\mexopts.bat
... Reading the mexopts.bat file to find the compiler and options used.
... LCC is the selected compiler
... OpenMP compiler not detected ... you may want to check this website:
http://openmp.org/wp/openmp-compilers/
... Using BLAS library lib_blas = 'C:\Program Files\MATLAB\R2008a\extern\lib\win32\lcc\libmwblas.lib'
... Now attempting to compile ...
mex('C:\Program Files\MATLAB\R2008a\sys\lcc\mtimesx\mtimesx.c',lib_blas,'-DCOMPILER=LCC')
it can´t find C:\Program Files\MATLAB\R2008a\sys\lcc\mtimesx\mtimesx.exp
it cant´find C:\Program Files\MATLAB\R2008a\sys\lcc\mtimesx\mtimesx.lib
... mex mtimesx.c build completed ... you may now use mtimesx.
then i introduce:
C = mtimesx(a,b)
??? Undefined function or method 'mtimesx' for input arguments of type 'double'.
what can i do?

댓글 수: 1

Walter Roberson
Walter Roberson 2013년 3월 15일
Have you tried with Visual C++ 2005 Express Edition ?

댓글을 달려면 로그인하십시오.

agustin darrosa
agustin darrosa 2013년 3월 15일

0 개 추천

yes, i installed it and i used mex-setup but i have this error
The mex command failed. This may be because you have already run mex -setup and selected a non-C compiler, such as Fortran. If this is the case, then rerun mex -setup and select a C/C++ compiler
before:
Select a compiler: [1] Lcc-win32 C 2.4.1 in C:\PROGRA~1\MATLAB\R2008a\sys\lcc\bin [2] Microsoft Visual C++ 2005 Express Edition in C:\Program Files\Microsoft Visual Studio 8
[0] None
Compiler: 2
Please verify your choices:
Compiler: Microsoft Visual C++ 2005 Express Edition Location: C:\Program Files\Microsoft Visual Studio 8
Are these correct [y]/n? y
*************************************************************************** Error: The Microsoft Platform Software Development Kit (SDK) was not found.
Microsoft Visual C++ 2005 Express Edition requires that the SDK is
installed properly. MEX uses the environment variable "MSSdk" to
find the SDK. If it is installed properly, please verify that the
environment variable "MSSdk" points to the correct location.
Otherwise, install the SDK and try again.
How can i install SDK???
thanks

카테고리

도움말 센터File Exchange에서 C Shared Library Integration에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by