 |
|
|
 |
|
 |
i am creating simulink rs model for overlapped symbol. for overlapping i have to use circular shift.i have used Embedded MATLAB Function block and write following function in that.
function y = fcn(u,Shft)
%#eml
y = circshift(u,Shft);
But using this i get output like if input is 5678 and shft is 2 then output is 7856.
Input of circular shift in my project is [16320*1] in bit format. now i want to do circular shift at every 64bits row. means circular shift happen at every 64bits continuously upto 16320.not at the end of 16320.
can any one have idea regarding this.
it is urgent.
hi my name is manish
currently i am a mca student
i want to know about how to develo a project in asp.net using c# languages
i want to became a master in developig software using asp.net with chi my name is manish
currently i am a mca student
i want to know about how to develo a project in asp.net using c# languages
i want to became a master in developig software using asp.net with chi my name is manish
currently i am a mca student
i want to know about h
|
|
|
|
 |
|
 |
I'm getting this error after building it. The build succeeded but it prompt this message after the CmdPrompt pops out.
An unhandled exception of type 'System.TypeInitializationException' occurred in Unknown Module.
Additional information: The type initializer for '<Module>' threw an exception.
|
|
|
|
 |
|
|
 |
|
 |
Hi
I am trying to implement data transfer by using the matlab API. but i am getting errors. right now i tried to send just one data without even defining into array and not defining the class CMATLAB. even for this application will i need that..
my code is:
#include "stdafx.h"
#include "engine.h"
#include <iostream>
#include <string>
int _tmain(int argc, _TCHAR* argv[])
{
using std::cout;
using std::cout;
int * data;
const char * t;
Engine * ep;
if (!(ep = engOpen(NULL))) {
cout <<"Matlab not open";
}
*data = 1;
engPutVariable(ep,*t,*data);
//engEvalString(ep,"plot()");
engClose(ep);
return 0;
}
I have included engine.h and matrix.h. Also all the necessary library files.
|
|
|
|
 |
|
 |
Hi,
i m trying to get an output value from matlab in c++ - but all i get is an adresse or the first value of my array:
this is my matlab array i would like to get in c++:
http://img3.imagebanana.com/img/wut1b4ny/contactpointmaxa.jpg[^]
this are the values im getting (view ERGEBNIS block at the end of the jpg)
http://img3.imagebanana.com/img/8dgsf5y0/ergebnis.jpg[^]
this is my code:
matlab.EvalString("[contactPointMaxA, contactPointMiddleA, contactPointMinA] = calcContactPointPlaneLagr(ebene,endeffektor1)");
contactPointMaxA = matlab.GetVariable("contactPointMaxA");
cout << "\n... ... ... Ergebnis: " << mxGetClassName(contactPointMaxA) << endl;
cout << "\n... ... ... Ergebnis: " << mxGetCell(contactPointMaxA,0) << endl;
cout << "\n... ... ... Ergebnis: " << mxGetCell(contactPointMaxA,1) << endl;
cout << "\n... ... ... Ergebnis: " << mxGetCell(contactPointMaxA,2) << endl;
cout << "\n... ... ... Ergebnis: " << mxGetPr(contactPointMaxA) << endl;
cout << "\n... ... ... Ergebnis: " << *mxGetPr(contactPointMaxA) << endl; // geht, erster value
cout << "\n... ... ... Ergebnis: " << sizeof(contactPointMaxA) << endl;
cout << "\n... ... ... Ergebnis: " << inContactPointMaxA << endl;
cout << "\n... ... ... Ergebnis: " << &inContactPointMaxA << endl;
cout << "\n... ... ... Ergebnis: " << mxGetChars(contactPointMaxA) << endl;
cout << "\n... ... ... Ergebnis: " << *mxGetChars(contactPointMaxA) << endl;
cout << "\n... ... ... Ergebnis: " << mxGetData(contactPointMaxA) << endl;
//cout << "\n... ... ... Ergebnis: " << *mxGetData(contactPointMaxA) << endl; // compilerfehler
cout << "\n... ... ... Ergebnis: " << mxGetScalar(contactPointMaxA) << endl; // geht, erster value
using the memcpy-tag ends in a runtime fatal error in visual c++. or i used it the worng way!
any ideas?
thank you!
Dabauer82
|
|
|
|
 |
|
 |
Hello,
i tried this:
***********************
char buffer[100] = "";
matlab.OutputBuffer(buffer, 100);
cout << "Output: " << buffer << endl;
***********************
to get the matlab outputbuffer but the variable buffer is empty at any place in my code . can somebody help me understand this function?
thank you
|
|
|
|
 |
|
 |
done!:
matlab.EvalString("main.m");
matlab.OutputBuffer(buffer, BUFSIZE);
printf("MATLAB OUTPUT:%s\n", buffer+1);
|
|
|
|
 |
|
 |
Hi,
I have written a traffic simulator based on C language, and I launch it using the Matlab engine functionality after compiling it with LCC.
Everything works well as long as I only pass single double variable from the simulator to the Matlab workspace. But I can't find a way to pass the whole Matrix, which is 28x5700.
I could not adapt the examples I have read here (using memcpy), probably I miss some background on this topic.
I have been striving against this for some weeks and any help will be very appreciated.
Thank you
Stefano.
|
|
|
|
 |
|
 |
I'm using UNIX platform whihc has MATLAB 2007b. My MPI FORTRAN calls MATLAB to use function "pwelch".
I'm getting following error :
*********************************************************************
terminate called after throwing an instance of 'MathWorks::System::SimpleException'
ERROR:engPutVariable
rank 5 in job 1 orville-1-8.local_39792 caused collective abort of all ranks
exit status of rank 5: return code 0
*********************************************************************
What does it mean?(memory related problem?)
How do i solve it,any idea?
Thanks in advance...
|
|
|
|
 |
|
 |
how to write code ROBUST EMBEDDING OF VISUAL WATERMARKS USING DWT-SVD
in matlab wil you please help me
thanking u
kishore
|
|
|
|
 |
|
 |
I'm running Visual Studio 8 and Matlab 7, now I've changed matlab.h to matrix.h, which allows it to compile properly, however when it tries to build it can't open "libmatlb.lib". As I understand it MatLab 7 doesn't require libmatlb.lib or libmmfile.lib, but when I take out the code that tries calling them I get 8 more build errors:
Matlab to C++.obj : error LNK2001: unresolved external symbol "public: virtual __thiscall CMatlabEng::~CMatlabEng(void)" (??1CMatlabEng@@UAE@XZ)
Matlab to C++.obj : error LNK2001: unresolved external symbol "public: int __thiscall CMatlabEng::Close(void)" (?Close@CMatlabEng@@QAEHXZ)
Matlab to C++.obj : error LNK2001: unresolved external symbol "public: int __thiscall CMatlabEng::EvalString(char const *)" (?EvalString@CMatlabEng@@QAEHPBD@Z)
Matlab to C++.obj : error LNK2001: unresolved external symbol "public: int __thiscall CMatlabEng::PutVariable(char const *,struct mxArray_tag const *)" (?PutVariable@CMatlabEng@@QAEHPBDPBUmxArray_tag@@@Z)
Matlab to C++.obj : error LNK2001: unresolved external symbol "public: int __thiscall CMatlabEng::SetVisible(bool)" (?SetVisible@CMatlabEng@@QAEH_N@Z)
Matlab to C++.obj : error LNK2001: unresolved external symbol "public: void __thiscall CMatlabEng::Open(char const *)" (?Open@CMatlabEng@@QAEXPBD@Z)
Matlab to C++.obj : error LNK2001: unresolved external symbol "public: __thiscall CMatlabEng::CMatlabEng(void)" (??0CMatlabEng@@QAE@XZ)
Debug/Matlab to C++.exe : fatal error LNK1120: 7 unresolved externals
Error executing link.exe.
Any ideas on how to get over this obstacle?
thanks for your time
TNT
|
|
|
|
 |
|
 |
I have exactly the same problem, if you already fixed it, please let me know.
thanks,
gvallemoura
|
|
|
|
 |
|
 |
hi, i have read the article about how to use matlab syntax in c++, but i cant understand it(maybe its because my english is not good enough).
actually, i want to do singular value decomposition(svd) function from matlab to my c++ project because i dont want to waste time to make the function myself..(actually i need some functions, not only svd)
anyone can tell me step by step how to use/connect matlab in c++?
u can send me an email to rifsolution@yahoo.com
please help me..
thanx..
btw, i use matlab 5.3, msvc++ 6.0, windows vista
|
|
|
|
 |
|
 |
Dir Sir,
I use Microsoft Visual Studio.NET, Matlab 6.5. I tried to use header flie "engine.h", but I meet the below problem:
This is my code:
-----------------
#include
#include
#include "engine.h"
void main()
{
Engine* ep;
ep = engOpen(NULL); // Connect to MATLAB engine
------------------
When I build project, I have the error:
error LNK2019: unresolved external symbol engOpen referenced in function_main
I look forward to hearing from you.
Thanks you so much.
Best regards,
|
|
|
|
 |
|
 |
Hi,
I have tried to run this code in visual studio 2005. I have changed Matlab.h to matrix.h, removed the unnecessary libs and the program compiles without error. However, at runtime I get an unhandled exception and a crash in gs_support.c in the lines listed below
#else /* defined (_WIN64) */
cookie = systime.ft_struct.dwLowDateTime;
cookie ^= systime.ft_struct.dwHighDateTime;
#endif /* defined (_WIN64) */
Please find error log below
'MatlabClass.exe': Loaded 'C:\Documents and Settings\mdp28\Desktop\MatlabEng_demo\Debug\MatlabClass.exe', Symbols loaded.
'MatlabClass.exe': Loaded 'C:\WINDOWS\system32\ntdll.dll', No symbols loaded.
'MatlabClass.exe': Loaded 'C:\WINDOWS\system32\kernel32.dll', No symbols loaded.
First-chance exception at 0x000a4ad6 in MatlabClass.exe: 0xC0000005: Access violation reading location 0x000a4ad6.
Unhandled exception at 0x000a4ad6 in MatlabClass.exe: 0xC0000005: Access violation reading location 0x000a4ad6.
The program '[3800] MatlabClass.exe: Native' has exited with code 0 (0x0).
Regards
Michael
|
|
|
|
 |
|
 |
Hi,
at first thanks for writing CMatlabEng.
I want to use an instance 'm_matlab' of CMatlabEng as a member in another class.
I wanted to open the Instance in the constructor (m_matlab.Open(NULL);) and close it in destructor. I found out that it only works when Opening 'm_matlab' in the same method where I want to use it.
Do you have some idea what´s the reason for this?
thanks in advance Jower
-jower
|
|
|
|
 |
|
 |
Hello!
Sounds familiar ... It seems the matlab engine can only be used within the same thread it's been initialized in. If your constructor is called within thread A and your actual data processing is done in another thread B, it won't work. (Check "GetCurrentThreadId()")
Its no solution but that's what I've figured out by now.
Best regards
Sven
|
|
|
|
 |
|
 |
I am using the MATLAB v7.0.0(R14)and changed "Matlab.h" to "Matrix.h".
But, when I have complied the "MatlabClass", I got the error message "cannot open file "libeng.lib" ".
Do I have to set the full path of "libeng.lib" in the "pragma comment(lib,HERE)"?
If it is right, please let me know where libeng.lib is.
Also, I couldn't find both "libmatlb.lib" and "libmmfile.lib" in the whole matlab folder.
thank you
best regards,
|
|
|
|
 |
|
 |
Maybe you didn't install MATLAB Compiler Toolbox.
A. Riazi
|
|
|
|
 |
|
 |
You don't need libmatlb.lib or libmmfile.lib anymore for Matlab 7.0, so get rid of those. I don't know how to help you with libeng.lib, though.
Good luck.
|
|
|
|
 |
|
 |
How do you get the values from the pointer? (I'm new at C++.)
I do this:
mxArray *myP;
myP = mxCreateDoubleMatrix(1, 1, mxREAL);
int inMyP[1][1];
memcpy((void*) mxGetPr(myP), (void*) inMyP, sizeof(inMyP));
matlab.PutVariable("myP", myP);
matlab.EvalString("myP=1;");
myP = matlab.GetVariable("myP");
cout << myP << endl;
But myP isn't 1.
Thanks.
|
|
|
|
 |
|
 |
You created a double matrix: mxCreateDoubleMatrix(....)
but declared an integer array: int inMyP[1][1];
change this line to double inMyP[1][1];
Best regards,
A. Riazi
|
|
|
|
 |
|
 |
Yay! I got it to work. This is the code, slightly modified from above. The way to fix it is to use the memcpy function, but flip the variables.
mxArray *myP = NULL;
myP = mxCreateDoubleMatrix(1, 1, mxREAL);
double inMyP[1][1];
//matlab.PutVariable("myP", myP); //Don't need.
matlab.EvalString("myP = 1");
myP = matlab.GetVariable("myP");
memcpy((void*) inMyP, (void*) mxGetPr(myP), sizeof(inMyP)); //This was the fix, notice that the variables are changed around.
cout << inMyP[0][0] << endl;
cout << endl;
mxDestroyArray(myP);
Thanks a bunch for your help.
-- modified at 16:09 Wednesday 10th January, 2007
|
|
|
|
 |
|
 |
myP is a pointer to mxArray structure. Then by using
cout << myP << endl;
you will see address of pointer. For printing the content of the matrix, use mlfPrintMatrix() function.
Here is the code:
mxArray *A;
A=mxCreateDoubleMatrix(3, 3, mxREAL);
memcpy(mxGetPr(A), (void *) imMyP, 3 * 3 * sizeof(double));
mlfPrintMatrix(A);
For more info, please see my other article: Solving Engineering Problems Using MATLAB C API[^]
Best regards,
A. Riazi
|
|
|
|
 |