f



Mex file crashes Matlab

Hello all,

I created successfully a mex file. It is linked to an external dll and it worked fine (it returns correctly to matlab a vector). Recently I added an new function inside my c++ file which does not affect the result of the c++ function but is just used to improve some data manipulation. By the way, this function works quite well in a simple c++ file and I have already used many times in other c++ files (no-mex files).
After added this function my matlab crashes and returns me this error:


MATLAB crash file:C:\DOCUME~1\MILCEMEA~1.VAA\LOCALS~1\Temp\matlab_crash_dump.2996
------------------------------------------------------------------------
       Segmentation violation detected at Wed Jul 28 18:38:04 2010
------------------------------------------------------------------------

  Operating System: Microsoft Windows XP
  Window System:    Version 5.1 (Build 2600: Service Pack 3)
  Processor ID:     x86 Family 6 Model 7 Stepping 10, GenuineIntel
  Virtual Machine:  Java 1.6.0_04-b12 with Sun Microsystems Inc. Java HotSpot(TM) Client VM mixed mode
  Default Encoding:  windows-1252

Fault Count: 1

Register State:
  EAX = ffff5df8  EBX = 00c2e01c
  ECX = ffffffff  EDX = e06d7363
  ESI = ffff5df4  EDI = 04f169ec
  EBP = 00c2e028  ESP = 00c2cf40
  EIP = 04ec186e  FLG = 00010286

Stack Trace:
  [0] qlDiscountFactors.mexw32:0x04ec186e(0x00c2e158 "x£", 0x00c2e0b8, 0x00c2e1fc, 0)
  [1] 0x00c2e20c(0x8b00032b, 0x04c483d8, 0x85e85d89, 0xb7840fdb)

This error was detected while a MEX-file was running............

Any suggestion???
thanks in advance
0
Paolo
7/28/2010 4:59:07 PM
comp.soft-sys.matlab 211266 articles. 23 followers. lunamoonmoon (257) is leader. Post Follow

5 Replies
1555 Views

Similar Articles

[PageSpeed] 46

"Paolo " <tarpanelli@libero.it> wrote in message <i2pnkr$gt7$1@fred.mathworks.com>...
> Hello all,
> 
> I created successfully a mex file. It is linked to an external dll and it worked fine (it returns correctly to matlab a vector). Recently I added an new function inside my c++ file which does not affect the result of the c++ function but is just used to improve some data manipulation. By the way, this function works quite well in a simple c++ file and I have already used many times in other c++ files (no-mex files).
> After added this function my matlab crashes and returns me this error:
> 
> 
> MATLAB crash file:C:\DOCUME~1\MILCEMEA~1.VAA\LOCALS~1\Temp\matlab_crash_dump.2996
> ------------------------------------------------------------------------
>        Segmentation violation detected at Wed Jul 28 18:38:04 2010
> ------------------------------------------------------------------------
> 
>   Operating System: Microsoft Windows XP
>   Window System:    Version 5.1 (Build 2600: Service Pack 3)
>   Processor ID:     x86 Family 6 Model 7 Stepping 10, GenuineIntel
>   Virtual Machine:  Java 1.6.0_04-b12 with Sun Microsystems Inc. Java HotSpot(TM) Client VM mixed mode
>   Default Encoding:  windows-1252
> 
> Fault Count: 1
> 
> Register State:
>   EAX = ffff5df8  EBX = 00c2e01c
>   ECX = ffffffff  EDX = e06d7363
>   ESI = ffff5df4  EDI = 04f169ec
>   EBP = 00c2e028  ESP = 00c2cf40
>   EIP = 04ec186e  FLG = 00010286
> 
> Stack Trace:
>   [0] qlDiscountFactors.mexw32:0x04ec186e(0x00c2e158 "x£", 0x00c2e0b8, 0x00c2e1fc, 0)
>   [1] 0x00c2e20c(0x8b00032b, 0x04c483d8, 0x85e85d89, 0xb7840fdb)
> 
> This error was detected while a MEX-file was running............
> 
> Any suggestion???
> thanks in advance





I FORGOT THE CODE IN MY PAST EMAIL:  (the function that crashes matlab is almost at the end of the code zcschedule().

---------------------------------------
#include "qlDiscountFactors.h"
#include <iostream>
#include <iomanip>
#include <ql/quantlib.hpp>
#include <ql/termstructures/yield/discountcurve.hpp>
#include <ql/math/interpolation.hpp>
#include <ql/indexes/iborindex.hpp>
#ifdef BOOST_MSVC
/* Uncomment the following lines to unmask floating-point
   exceptions. Warning: unpredictable results can arise...
   See http://www.wilmott.com/messageview.cfm?catid=10&threadid=9481
   Is there anyone with a definitive word about this?
*/
//#include <float.h>
// namespace { unsigned int u = _controlfp(_EM_INEXACT, _MCW_EM); }
#endif
#include <boost/timer.hpp>
#include <iostream>
#include <iomanip>
#if defined(QL_ENABLE_SESSIONS)
namespace QuantLib {
    Integer sessionId() { return 0; }
}
#endif

#pragma comment(lib, "libmx.lib")
#pragma comment(lib, "libmat.lib")
#pragma comment(lib, "libmex.lib")

using namespace std; 
using namespace QuantLib;

std::vector<Date> genListOfDates(Date startdate, 
			 Date enddate, 
			Period freq, 
			 BusinessDayConvention rollconv, 
			 Calendar cal)
{
	std::vector<Date> listofdates;
	listofdates.push_back(startdate);
	Date tempdate=startdate;
	while (tempdate <= enddate) {
	     Date newtempdate = cal.advance(tempdate,freq,rollconv,false);
	     listofdates.push_back(newtempdate);
	     tempdate = newtempdate;
	}
	return listofdates;
}

BusinessDayConvention getRollingConventionfromnum(int num)
{
    switch(num)
    {
    case 1:
        return Preceding;
        break;
    case 2:
        return ModifiedPreceding;
        break;
    case 3:
        return Following;
        break;
    case 4:
        return ModifiedFollowing;
        break;
    }
}

TimeUnit getTimeUnitfromnum(int num)
{
	switch(num)
	{
	case 1:
		return Days;
		break;
	case 2:
		return Weeks;
		break;
	case 3:
		return Months;
		break;
	case 4:
		return Years;
		break;
	}

}

Calendar createCalendarfromnum(int num)
{
    switch(num)
    {
        case 1 :
			return Argentina();
            break;
        case 2 :
            return Australia();
            break;
        case 3:
            return BespokeCalendar();
            break;
        case 4:
            return Brazil();
            break;
        case 5:
            return Canada();
            break;
        case 6:
            return China();
            break;
        case 7:
            return CzechRepublic();
            break;
        case 8:
            return Denmark();
            break;
        case 9:
            return Finland();
            break;
        case 10:
            return Germany();
            break;
        case 11:
            return HongKong();
            break;
        default:
            throw("unknown calendar number");
    }
}

DayCounter createDayCounterfromnum(int num)
{

    switch(num)
    {
        case 1 :
			return Actual365Fixed();
            break;
        case 2 :
            return Actual360();
            break;
        case 3:
            return Thirty360(Thirty360::USA);
            break;
        case 4:
            return Thirty360(Thirty360::European);
            break;
        case 5:
            return Thirty360(Thirty360::Italian);
            break;
        case 6:
            return ActualActual(ActualActual::Bond);
            break;
        case 7:
            return ActualActual(ActualActual::Euro);
            break;
        case 8:
            return ActualActual(ActualActual::Historical);
            break;
    }
}

void mexFunction(int nlhs, mxArray *plhs[], int nrhs, mxArray *prhs[])
{
	mxArray *inDates = prhs[0];
	double nDates = mxGetScalar(prhs[1]);
	mxArray *inInstruments = prhs[2];
	double nInst = mxGetScalar(prhs[3]);
	double dcf = mxGetScalar(prhs[4]);
	double roll = mxGetScalar(prhs[5]);
	double cal = mxGetScalar(prhs[6]);
	double interp = mxGetScalar(prhs[7]);

	plhs[0]=mxCreateDoubleMatrix(nDates-1,1,mxREAL);

	qlDiscountFactors(mxGetPr(inDates), (int)nDates, mxGetPr(inInstruments) , (int)nInst, (int)dcf, (int)roll, (int)cal, (int) interp, mxGetPr(plhs[0]));

  }

void qlDiscountFactors(double *refdate, 
		   int nDates,
	       double *instruments,
	       int nInst,
	       int daycounter,
	       int rollconv,
	       int calnum,
	   int interp,
	   double *oDF)
{
	try {
	
	// Day counter constructor
	DayCounter daycount;
               daycount = createDayCounterfromnum(daycounter);

	// Rolling convention constructo
	BusinessDayConvention rollconvention;
	rollconvention = getRollingConventionfromnum(rollconv);

	// Calendar constructor
	Calendar cal;
                 cal= createCalendarfromnum(calnum);

	// Retrieve the reference date and settlement date
	Date referencedate((int)refdate[0]);
	std::vector<Date> settlementdates;
	int i=0;
	for (i=0; i<nDates-1; ++i) {
		Date settdate((int)refdate[i+1]);
		settlementdates.push_back(settdate);
	}

	// Deposit rate constructors
	Rate deporates;
	
	// Future price constructors
	Real futprices;

	// Swap rate constructors
	Rate swrates;

	// Zero coupon constructors
	Real couponrates;
	Real cleanprice = 100.0;
	Real redemption = 100.0;

	// Instruments collection
	std::vector<boost::shared_ptr<RateHelper>> instrumentCollection;

	// Instruments for yield curve bootstrapping
	int typeofinst;
	Integer numtenor;
	TimeUnit tenor;
	Natural fixingdays = 0;
	Integer futmonths = 3;
	Frequency swFixedLegFreq = Annual;
	Frequency bondFreq = Annual;
	BusinessDayConvention swFixedLegConv = Unadjusted;
	DayCounter swFixedLegDc = Thirty360(Thirty360::European);
	boost::shared_ptr<IborIndex> swFloatingLegIndex(new Euribor6M);
	Settings::instance().evaluationDate() = referencedate;
	for (i=8; i<nInst; i++) {
		if ((instruments[i] + 0.5) >= ((int)instruments[i] + 1)) {
			typeofinst = (int)instruments[i] + 1;
		} else {
			typeofinst = (int)instruments[i];
		}
		if (typeofinst == 1) { 						...............							if (typeofinst == 4) {	// Bond instruments <---			               couponrates = instruments[nInst+i];
			boost::shared_ptr<SimpleQuote> bondquotes(new SimpleQuote(cleanprice));
			if ((instruments[2*nInst+i] + 0.5) >= ((int)instruments[2*nInst+i] + 1)) {
				numtenor = (int)instruments[2*nInst+i] + 1;
			} else {
				numtenor = (int)instruments[2*nInst+i];
			}
			if ((instruments[3*nInst+i] + 0.5) >= ((int)instruments[3*nInst+i] + 1)) {
				tenor = getTimeUnitfromnum((int)instruments[3*nInst+i] + 1);
			} else {
				tenor = getTimeUnitfromnum((int)instruments[3*nInst+i]);
			}
			Date thismaturity = cal.advance(referencedate,numtenor*tenor);
			Schedule zcschedule(referencedate,
					thismaturity,
					Period(bondFreq),
					cal,
					rollconvention,
					rollconvention,
					DateGeneration::Backward,
					false);
			boost::shared_ptr<FixedRateBondHelper> zcratehelper(new FixedRateBondHelper(Handle<Quote>(bondquotes),
																			   0,
																			   cleanprice,
																			   zcschedule,
																			   std::vector<Rate>(1,couponrates),
																			   daycount,
																			   rollconvention,
																			   redemption,
																			   referencedate));

			instrumentCollection.push_back(zcratehelper);
		}

	}	// end for
	
	// Yield curve constructor
/*	double tolerance = 1.0e-15;
	boost::shared_ptr<YieldTermStructure> depoFutSwapTermStructure(new PiecewiseYieldCurve<Discount,LogLinear>(referencedate,
																											   instrumentCollection,
																											   daycount,
																											   tolerance));
	RelinkableHandle<YieldTermStructure> discountCurve;
	discountCurve.linkTo(depoFutSwapTermStructure);
*/	
	// Interpolated discount factors
	for (i=0; i<nDates-1; ++i) { 
//		DiscountFactor df = discountCurve->discount(settlementdates[i],true);
		oDF[i] = 1.09;
	}
	
	} catch (std::exception& e) {
        std::cerr << e.what() << std::endl;
    } catch (...) {
        std::cerr << "unknown error" << std::endl;
    }

}
0
tarpanelli (44)
7/28/2010 5:17:07 PM
Dear Paolo,

> Any suggestion???
The new function, you have added, seems to have a bug. Use a debugger to locate it. If you can locate the error within less than 20 lines of code, it sometimes help to post the code here, because 40.000 eyes can see more than 2.

Did you expect a more detailed or specific answer? Then we'd need a more detailed and specific description of the problem.

Good luck, Jan
0
Jan
7/28/2010 5:21:05 PM
Hi Jan,

debugging the code this is the exception I got:

"Unhandled exception at 0x04ce3620 (qlDiscountFactors.mexw32) in MATLAB.exe: 0xC0000005: Access violation writing location 0xffff5df8."

and the line is this

void release() // nothrow
    {
 ----------->       if( BOOST_INTERLOCKED_DECREMENT( &use_count_ ) == 0 )
        {
            dispose();
            weak_release();
        }
    }

Thanks in advanvance,
Paolo

"Jan Simon" <matlab.THIS_YEAR@nMINUSsimon.de> wrote in message <i2pou1$cfm$1@fred.mathworks.com>...
> Dear Paolo,
> 
> > Any suggestion???
> The new function, you have added, seems to have a bug. Use a debugger to locate it. If you can locate the error within less than 20 lines of code, it sometimes help to post the code here, because 40.000 eyes can see more than 2.
> 
> Did you expect a more detailed or specific answer? Then we'd need a more detailed and specific description of the problem.
> 
> Good luck, Jan
0
Paolo
7/28/2010 5:51:04 PM
Dear Paolo,

we cannot run your code, because we do not have the libs you use.
The description of the error is not complete. We see the line, but cannot find the corresponding line in the code you've posted.

You have to inspect the values of the variables and pointers using the debugger. I do not expect that the newsgroup can solve such problems.

Kind regards, Jan
0
Jan
7/28/2010 6:23:05 PM
Paolo wrote:
> Hi Jan,
> 
> debugging the code this is the exception I got:
> 
> "Unhandled exception at 0x04ce3620 (qlDiscountFactors.mexw32) in 
> MATLAB.exe: 0xC0000005: Access violation writing location 0xffff5df8."
> 
> and the line is this
> 
> void release() // nothrow
>    {
> ----------->       if( BOOST_INTERLOCKED_DECREMENT( &use_count_ ) == 0 )
....

so, what are BOOST_INTERLOCKED_DECREMENT and use_count_?

Assuming the debugger is able to catch the exception at the point it is 
actually thrown, it would appear there's a problem here.

--
0
dpb
7/28/2010 7:43:45 PM
Reply:

Similar Artilces:

mex file, matlab crashes
I have a mex file, i deallocate memory for every thing i use, apart from a waveform which receive.I allocate space for it through mxCalloc and doesnot set if free. the matlab call is [a,b]=my_func(c,d) the mex file compiles smoothly and the first time i call the function in matlab, it works smoothly, but when i call the function again , the workspace goes blank, though if i type 'a' in command window, i can see the contents of a, and i can plot the contents of a too, now if i plot again, the matlab simply crashes (segment violation), it says to save ur work and restart matlab, ...

Matlab crashes while calling Mex file
Hi, My problem is as follows: I created a mex file called getCg(), in order to use some functions of the c-files I have in my matlab model. Problem is, after calling the mex file 'getCg()' several times matlab crashes. That is, when I write >>for i=1:28, a(i) = getCgOnGas(50*i); end command several times matlab crashes immediately. Do you have any idea what could be the reason? Here is the mex file I have: #include<mex.h> #include"gas.h" #include"gasdb.h" #include"global.h" #include"heat.h" #include"hss.h" #include"...

how to call matlab file to another matlab file
Hey friends, 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 file..... waiting for ur valuable suggestion thanks ...

MATLAB crashes by calling this mex file
I am using the following mex syntax/definition. I build the mex in MATLAB but when calling the generated mex, MATLAB crashes. I have tried mex -g option but still when debugging, MATLAB crashes. When I debug the ".cpp" file in Visual Studio, it runs perfectly and generates the correct results but running the generated "mex" seems impossible. How can I find the source of memory leakage? " void mexFunction( int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[] ) { double *expected_output, *apriori_uncoded_llrs, *encoded_input, sigma2, *extrinsic_uncoded_llrs; ...

mex file, matlab crashes #2
I have a mex file, i deallocate memory for every thing i use, apart from a waveform which receive.I allocate space for it through mxCalloc and doesnot set if free. the matlab call is [a,b]=my_func(c,d) the mex file compiles smoothly and the first time i call the function in matlab, it works smoothly, but when i call the function again , the workspace goes blank, though if i type 'a' in command window, i can see the contents of a, and i can plot the contents of a too, now if i plot again, the matlab simply crashes (segment violation), it says to save ur work and restart matlab, ...

Matlab crashes while running mex file
Dear all, I am running mex file successfully in all folders except one. In the folder where i am not able to run it ,Matlab gives segmentation violation and crashes . Sometimes it gives runtime error and closes down. I am not able to understand that when it is successfully running (same mex file) in all folders why here not? Can anybody help me out? Thanks and regards, T.Jain Hi T.Jain Trapti Jain wrote: > I am running mex file successfully in all folders except one. In the > folder where i am not able to run it ,Matlab gives segmentation > violation and crashes . Sometimes it gi...

Matlab crashes when running fortran mex file
First of all, I have ubuntu with gfortran 4.6.1 and f95 4.6.1compiler and I am using the mtlab R2007a. The problem is when I compile the examples code "timetwo.F" given in matlabroot/extern/examples/refboof, compilations goes through but when I run it in the matlab, matlab crashes. I think I have library compatibity issues because the code runs fine on my other machine which have older libraries. Here is what are the libraries in my matlabR2007a/sys/os/glnxa64 folder: libgfortran.so.1 -> /usr/lib/x86_64-linux-gnu/libgfortran.so.3 libiberty.so libXm.so.3 -> libXm.so....

MEX File Crashes MATLAB on repeated usage
I'm using a MEX file in another M-file. The MEX file gets called several times inside the M-file with no crash. If I rerun the M-file however, MATLAB crashes due to the MEX file. If I clear the MEX file from memory(via "clear functions"), everything works fine. Any idea on what might be causing this problem? Kind regards, Ustun ustunozgur <ustunozgur@gmail.com> wrote in message <8ddcc8cc-c4f5-49e9-ab73-5dce98468e7a@m19g2000yqk.googlegroups.com>... > I'm using a MEX file in another M-file. The MEX file gets called > several times inside the M-file with ...

Boost threads in a mex file cause matlab to crash.
I'm having some issues getting matlab and boost threads to work together. I'm posting here and a number of other places as I don't think this problem fits into any one domain. Specifically, whenever I try to use boost threads within a mex file, it causes matlab to crash. My test program is: #include <boost/thread/thread.hpp> #include <boost/bind.hpp> #include "mex.h" class TestClass { public: void run(); }; void TestClass::run() { for (int n = 0; n < 5; n++) { sleep(1); } } void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *...

Why can't Fortran-mex files be compiled on matlab V5.3 and run on matlab V6?
Hi, does anyone know why Fortran-mex files can't be compiled on matlab V5.3 and run on matlab V6? For example: if I compile the example-program (shipped with matlab) timestwo.f on matlab version 5.3 (R11) and try to run it on matlab version 6+ (R12 or R13), I get the error message: "Unable to load mex file: E:\timestwo.dll. The specified module could not be found. ??? Invalid MEX-file" Likewise if I compile it on matlab version 6.1 (R12), I get a similar error message if run on matlab version 5.3 (R11). However, if I run it on matlab version 6.5 it works OK. If I try the same experiment with the corresponding example file written in C, timestwo.c, I get no such problems. Why is that? Per A. Hi Per, usually MEX-files need to be compiled with the MATLAB version you want it later to run with. The reason is, that the code links against the current dynamic libraries (DLLs), which may change from version to version. You may have luck that it works (see your example of timestwo.f), but you should never rely on this. Titus "Per A. Brodtkorb" <Per.Brodtkorb@ffi.no> wrote in message news:eecb303.-1@webx.raydaftYaTP... > Hi, > > does anyone know why Fortran-mex files can't be compiled on matlab > V5.3 and run on matlab V6? > > For example: if I compile the example-program (shipped with matlab) > timestwo.f > on matlab version 5.3 (R11) and try to run > it on matlab version 6+ (R12 or R13), I ...

Does anybody know a way to convert Matlab code into Fortran and then compile Fortran mex dll file for Matlab 2006a?
Hi all, I want to ask three questions regarding Fortran and Matlab interface. The two tools I am using are: Intel Visual Fortran 10.1 and Matlab 2006a. Q1. What is the best converter to convert Matlab code into Fortran code with readability? My understanding is that Fortran and Matlab are both vectorized and they should be pretty similar and such converter should do a good job. Q2. Is there a wizard for Intel Visual Fortran under MS Visual Studio.Net 2003 or Visual Studio.Net 2005 to set up environments for building mex dll file for Matlab on Windows XP? There is such a wizard tool for VC/C++, which is very convenient, just create a MEX project in Visual Studio and the compiled the result will be a mex dll for use in Matlab. I hope there is a similar tool for Fortran? Q3. Is there a tool to convert the Matlab code into Fortran with readability and then automatically make itself a mex dll? Thanks a lot! On Jul 6, 9:49 pm, "Linus Utopia" <linus_uto...@gmail.com> wrote: > Hi all, > > I want to ask three questions regarding Fortran and Matlab interface. The > two tools I am using are: Intel Visual Fortran 10.1 and Matlab 2006a. > > Q1. What is the best converter to convert Matlab code into Fortran code with > readability? My understanding is that Fortran and Matlab are both vectorized > and they should be pretty similar and such converter should do a good job. > > Q2. Is there a wizard for Intel Visual Fortran under ...

convert a .mat file (Matlab 6.5) to a .mat file(Matlab 4)
Hello I've just started using a program, and i need to import data to this program. There are other options but I prefer to import it from matlab...but this program only support matlab 4 version. I want to convert it my file but i son't know why....I've proved with save as..but i had no chance. What i have to do?Someone can help me? Thank you very much! Bye!! Michael wrote: > Hello I've just started using a program, and i need to import data to > this program. There are other options but I prefer to import it from > matlab...but this program only support matlab 4 v...

How to set path for .M files. How to include, and verify a file in the MATLAB path. In other words I wish to learn how to setup the path for .M file in MATLAB path? Thanks.
undefined ...

matlab mex file
I want to create a mex file to be called by matlab. I have done all the basic stuff and got the examples to work. But now I want to create a much more ellaborate external c program. But all my calles to things like "strcta" or "CreateFile" which works well in MSVC6.0 fials to compile and link here. How do I do this? Thanks Henry henry terhani wrote: > I want to create a mex file to be called by matlab. I have done all > the basic stuff and got the examples to work. But now I want to > create a much more ellaborate external c program. But all my calles > to thin...

How to set path for .M files. How to include, and verify a file in the MATLAB path. In other words I wish to learn how to setup the path for .M file in MATLAB path? Thanks. #2
undefined ...

matlab crashes (win 7 64 bit) without messages, logs or dumps while using mex-files linked with itpp library and compiled with mingw
Hello, I know, that this a very special problem and I would like to provide an error log or something like this, but this is the problem. Following situation: Matlab 2010a (64bit) on Win 7 64bit Enterprise Mingw-w64 with basis msys environment used modified gnumex to create .def and .lib files mexopt.bat modified to work with mingw This setup works perfectly. I can write,compile,link and run mex files. Moreover, I compiled the itpp library with msys/mingw and created static libs as well as shared libs. Now, the problem: At the point, when I include an itpp related class of fu...

Forcing Matlab to run .m file when a mex file is present
I am creating an environment to test mex files which will replace exisiting m files in an extensive matlab simulation. As I do this I want to be able to check that the results from the new mex function are the same as the result from the existing m file function. Is there a slick way to force Matlab to call the m file function when a mex function of the same name exists? Ideally I would want to do something like: a = my_function(x,y,z) % calls the mex version b = my_function(x,y,z) % calls the m file version error = abs(a-b); Any suggestions that don't require renaming files? Thanks a l...

How to call or pass MATLAB file pointer in C Mex file?
Hello all, 1. I am trying to read large binary data files (~1 GB size), process the information and dump the outputs (which are also of incredibly big size) to MATLAB workspace. I wrote a mex file to do the same (so that I have faster program execution speeds). 2. The C mex file that I wrote works very well and can dump all the variables to MATLAB workspace for smaller size files. However for larger binary files, the MATLAB gives OUT OF MEMORY error as the size of the variable space is simply too big. 3. Often I am not interested in all portions of the file and don't need all the variab...

Cantera using Matlab R2010b: matlab crashes
Hi, I'm trying to use Cantera on windows 7 Professional 64bit using Matlab R2010b. Matlab crashes as soon as function: advance(reactor, t) is getting executed. I have installed Cantera 1.88 and Python 2.6 (both for 64 bit windows). The same code works perfectly fine on a 32bit machine where i have Cantera 1.7 and Python 2.5. I'm using the correct executable(ctmethods.mexw64) file for 64bit machine. Any help will be appreciated. Regards Prakhar (grad student, Caltech) ...

Windows 7 file Explorer crashing on encountering Matlab .mat files
I started encountering what appears to be an unusual problem: Windows 7 file Explorer started crashing and automatically restarting consistently on opening or browsing any directory containing Matlab .mat files! Just for example, renamimg a .mat file extension to .matmat helps explorer to browse directory and renaming it back to .mat immediatelly crashes the explorer. I looked int blogs and it appear to be happening to others but mainly with media (e.g. mpeg) files. On my machine, .mat is associated to Matlab via the registry but I can not even run file to program association utili...

[C file I/O (via mex)] content written to file is only present if matlab is closed
Hello, 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" ...

Mex File Slows Matlab
I have wrote a C++ mex file to provide a pause function as matlab's is too inaccurate for my application. However, with this running, the pause function 'takes over' matlab and the computer, making operations slower. Is there any way I can override this and make the two integrate more nicely (thread them)? Matt wrote: > > > I have wrote a C++ mex file to provide a pause function as matlab's > is too inaccurate for my application. However, with this running, > the pause function 'takes over' matlab and the computer, making > operations slower. Show us your MEX file and we'll (try to) tell you why it sucks your CPU. ...

Using mex files in Matlab
I often translate the most computationally expensive routines in C++ using IT++ library, then I call these routines from Matlab as mex files. IT++ library (https://sourceforge.net/apps/wordpress/itpp/) uses blas/acml functions to handle matrix/vector operations and is entirely written in C++. The problem seems to be that Matlab does not handle properly calls to routines from blas/acml libraries. Both, Matlab and IT++ use these libraries, but they are stored in different places. Short example: buf = intrinsic_coded(i*nb_outputs,(i+1)*nb_outputs-1); The line above is executed from a C++ prog...

matlab mex file (fortran)
I want to create the mex file from external fortran file (file.for). I use compaq visual fortran 6.6a and matlab v13. Pleas help me. I have still the same problem. ------------------------------------------------------ >> mex -setup Please choose your compiler for building external interface (MEX) files: Would you like mex to locate installed compilers [y]/n? y Select a compiler: [1] Compaq Visual Fortran version 6.6 in C:\Program Files\Microsoft Visual Studio [2] Lcc C version 2.4 in C:\MATLAB6P5\sys\lcc [3] Microsoft Visual C/C++ version 6.0 in C:\Program Files\Microsoft Visual Stu...

Web resources about - Mex file crashes Matlab - comp.soft-sys.matlab

Lightning Crashes - Wikipedia, the free encyclopedia
" Lightning Crashes " is a song by the rock band Live , from their 1994 album, Throwing Copper . The track wasn't released as a single in the ...

When New York Times website crashes, newspaper turns to Facebook Notes
When The New York Times’ website suffered some downtime Wednesday because of technical issues, the newspaper turned to Facebook Notes to post ...


Adorable Baby Crashes Daddy's Concert - YouTube
17 month old baby, Ethan ran out onstage when his dad, country singer Coffey, was performing at NYE event, started dancing, and stole the show. ...

Syria army plane crashes while bombing rebel-held town
A Syrian military aircraft crashed while on a bombing run over the rebel-held north-western town of Ariha on Monday, leaving at least 12 people ...

Escape Fail of the Day: Perp Crashes Getaway Car, Demolishes Building
I guess you could call this Car-ma? A woman in Kansas City drove a stolen SUV into a building last week while being chased by police. Not only ...

Canberra cyclist Nathan Haas crashes out of Paris-Nice, Michael Matthews still in yellow
Canberra cyclist somehow avoids serious injury as he gets a close-up look at the French countryside.

Five men dead in two crashes in horror night on country WA roads
WA’s top road safety experts are shocked by the deaths of 11 people in the worst three-day period on our roads.

Australian dollar climbs above US75¢, New Zealand dollar crashes on rate cut
The Australian dollar strengthened above US75&cent; overnight, retaining its popularity despite iron ore prices tumbling almost 9 per cent. ...

Motorcyclist killed in Lalor as Melbourne's horror year of crashes continues
Melbourne's horror year of motorcycle crashes has continued, with another man dying after coming off his bike in Lalor Saturday morning.

Resources last updated: 3/15/2016 1:17:28 PM