From: Aditya on 26 Mar 2010 03:23 "Aditya " <adityapatel.2006(a)gmail.com> wrote in message <hohirk$2ka$1(a)fred.mathworks.com>... > "James Tursa" <aclassyguy_with_a_k_not_a_c(a)hotmail.com> wrote in message <hogscd$pue$1(a)fred.mathworks.com>... > > "Aditya " <adityapatel.2006(a)gmail.com> wrote in message <hogq72$nl6$1(a)fred.mathworks.com>... > > > "James Tursa" <aclassyguy_with_a_k_not_a_c(a)hotmail.com> wrote in message <hogn1n$5pr$1(a)fred.mathworks.com>... > > > > "Aditya " <adityapatel.2006(a)gmail.com> wrote in message <hoghqq$ao3$1(a)fred.mathworks.com>... > > > > > > > > > > engPutVariable(ep,t, v); > > > > > > > > I don't see anywhere that you set t to anything valid. Looks like you are passing an uninitialized pointer to engPutVariable. > > > > > > > > James Tursa > > > > > > Hey > > > > > > Actually C Syntax > > > > > > #include "engine.h" > > > int engPutVariable(Engine *ep, const char *name, const mxArray > > > *pm); > > > engPutVariable writes mxArray pm to the engine ep, giving it the variable name name. > > > > > > So i wanted to define the variable in the workspace as t. > > > > Then you should have called it like this: > > > > engPutVariable(ep,"t", v); > > > > > Also the problem is occurring before the execution of command. > > > Suppose i comment the whole data trasnfer part and i just try to open the engine and close it.. Still it says the same violation error. > > > > Not sure what the problem is there. You don't get any message at all, it just crashes? > > > > James Tursa > > Maybe there is a problem in intialisation of the t pointer and it will work .. But the main problem or error even when i comment the data transfer part is the same:Unhandled exception at 0x0001ae30 in data3.exe: 0xC0000005: Access violation and asks me to break the program. > > So i am not able to understand why? One factor which i think can be that the OS which i have is 64bit where is my Matlab and VC++ are installed in 32 bit.. > > thanks Just now i tried it on a 32 bit system. after deleting the data transfer part the program is : #include "engine.h" #include <iostream> #include <string> #include "matrix.h" int _tmain(int argc, _TCHAR* argv[]) { using std::cout; Engine * ep; if (!(ep = engOpen(NULL))) { cout <<"Matlab not open"; } engClose(ep); return 0; } And the error is: Unhandled exception at 0x000194c0 in data3.exe: 0xC0000005: Access violation reading location 0x000194c0. Cant seem to figure out whats wrong with it. regards, aditya
From: James Tursa on 26 Mar 2010 03:35 "Aditya " <adityapatel.2006(a)gmail.com> wrote in message <hohndi$84u$1(a)fred.mathworks.com>... > > Just now i tried it on a 32 bit system. after deleting the data transfer part > > the program is : > > #include "engine.h" > #include <iostream> > #include <string> > #include "matrix.h" > > int _tmain(int argc, _TCHAR* argv[]) > { > using std::cout; > > Engine * ep; > if (!(ep = engOpen(NULL))) { > cout <<"Matlab not open"; > } > engClose(ep); > return 0; > } > > And the error is: > Unhandled exception at 0x000194c0 in data3.exe: 0xC0000005: Access violation reading location 0x000194c0. Just tried this on a 32-bit system with MSVC and it works just fine: #include "engine.h" #include <iostream> #include <string> #include "matrix.h" int main(int argc, char* argv[]) { using std::cout; Engine * ep; if (!(ep = engOpen(NULL))) { cout <<"Matlab not open"; } engClose(ep); return 0; } I can't reproduce your error. James Tursa
From: Aditya on 26 Mar 2010 14:00 "James Tursa" <aclassyguy_with_a_k_not_a_c(a)hotmail.com> wrote in message <hoho3t$idh$1(a)fred.mathworks.com>... > "Aditya " <adityapatel.2006(a)gmail.com> wrote in message <hohndi$84u$1(a)fred.mathworks.com>... > > > > Just now i tried it on a 32 bit system. after deleting the data transfer part > > > > the program is : > > > > #include "engine.h" > > #include <iostream> > > #include <string> > > #include "matrix.h" > > > > int _tmain(int argc, _TCHAR* argv[]) > > { > > using std::cout; > > > > Engine * ep; > > if (!(ep = engOpen(NULL))) { > > cout <<"Matlab not open"; > > } > > engClose(ep); > > return 0; > > } > > > > And the error is: > > Unhandled exception at 0x000194c0 in data3.exe: 0xC0000005: Access violation reading location 0x000194c0. > > Just tried this on a 32-bit system with MSVC and it works just fine: > > #include "engine.h" > #include <iostream> > #include <string> > #include "matrix.h" > > int main(int argc, char* argv[]) > { > using std::cout; > > Engine * ep; > if (!(ep = engOpen(NULL))) { > cout <<"Matlab not open"; > } > engClose(ep); > return 0; > } > > I can't reproduce your error. > > James Tursa Hi Thanks Can you suggest me ,what could be the problem? I am attaching the necessary files in the linker input properties (all the lib files necessary) and all the header files. I am using Maltlab r2009a and visual studio 2008 on a 64 bit vista system.
From: James Tursa on 26 Mar 2010 14:59 "Aditya " <adityapatel.2006(a)gmail.com> wrote in message <hoisnl$qus$1(a)fred.mathworks.com>... > > Can you suggest me ,what could be the problem? I am attaching the necessary files in the linker input properties (all the lib files necessary) and all the header files. > > I am using Maltlab r2009a and visual studio 2008 on a 64 bit vista system. I always compile with the mex command at the MATLAB prompt. How are you doing the compile? James Tursa
From: Aditya on 27 Mar 2010 13:53
"James Tursa" <aclassyguy_with_a_k_not_a_c(a)hotmail.com> wrote in message <hoj05p$qoi$1(a)fred.mathworks.com>... > "Aditya " <adityapatel.2006(a)gmail.com> wrote in message <hoisnl$qus$1(a)fred.mathworks.com>... > > > > Can you suggest me ,what could be the problem? I am attaching the necessary files in the linker input properties (all the lib files necessary) and all the header files. > > > > I am using Maltlab r2009a and visual studio 2008 on a 64 bit vista system. > > I always compile with the mex command at the MATLAB prompt. How are you doing the compile? > > James Tursa I wajs running the code as a project in visual studio. Can you explain how to compile with the mex command and run it? thanks |