f



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)?
0
5/24/2005 3:42:15 PM
comp.soft-sys.matlab 211266 articles. 24 followers. lunamoonmoon (257) is leader. Post Follow

1 Replies
490 Views

Similar Articles

[PageSpeed] 51

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.
0
me5685 (266)
5/24/2005 8:25:27 PM
Reply:

Similar Artilces:

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 crashing with MEX file in function working well outside of MATLAB
Hi Everyone, I have an high level problem (I believe) that I will try to explain; My development platform is: 64bit Ubuntu 12.04 LTS and MATLAB 2013b with GCC/G++-4.7 library I am trying to create a MATLAB interface by coding a MexFunction using gigantic C++ library previously developed. For the tests I previously build and MexFunction only using and parsing XML files as inputs where paths are hardly defined within the function (for simplification and debugging), and I am not passing any input and output with *plhs and *prhs yet. My code includes MexFunction can be compiled without any problem, but when I try to run it, It is crashing MATLAB so I need to end MATLAB and relaunch. The problem occurs in the following line (probably this information is irrelevant) oca_parser::OcaParser* oca ( new oca_parser::OcaParser( ( inpath / operational_context_name ).native_file_string() , oca_parser::AIXM_FORMAT ) ); - Basically this code is parsing a XML file and writing in a class - this function is completely working outside of the MATLAB in existing C++ test code - For debugging I have used try {...} catch {...} and sometimes (if I had newly restarted OS and launched fresh MATLAB) I have got std::bad_alloc error. - Since it seems like running out of memory problem, I have create very small XML file for input -- so error has been disappeared! But of course I need to use whole XML files and their size are not bigger than ~180 KB. Sorry for the lon...

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. ...

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 ...

C++ Mex file crashes matlab on 64bit linux, but not 32 bit windows, but program runs fine outside Matlab
Hello, 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. ...

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...

Slow Matlab vs. Fast Matlab
I have a Matlab simulation that I run at work that takes 4+ hours. When I run it from home thru a VPN to my employer it's about 20x quicker! I'm trying to figure out what the issue could be. The loading on the computer is about the same at work and at home. It has to be something related to our computer network at work vs. my network at home, but I'm not sure where to look. Any ideas? On 10-12-02 01:24 PM, Kevin wrote: > I have a Matlab simulation that I run at work that takes 4+ hours. When > I run it from home thru a VPN to my employer it's about 20x quick...

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 ...

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...

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...

MATLAB.App File Type (to compile mex-files with Codewarrior on MacOSX) ?
Hello I am trying to compile a project (to have a mex-file at the end) with Codewarrior9 and Matlab7 (on a Mac). It works fine with Matlab5 and Codewarrior8, but not now. One of my problem is that Matlab5 was put in the project (I don't know how, it's not my project). Now I want to swap to Matlab7, but when I want to add it, Matlab7 appears as a directory (not in the Mac Finder though). The moderator of CW adviced me to check the extension of Matlab7 and add it to the mapping files settings of my project. However, I have no idea of what Matlab's File Type is. Also, CW asks me for ...

[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" ...

How to Mex a cpp file in Matlab
Hi everybody, I know how to make a Mex file for a simple CPP file. But when I want to compile a more complicated CPP program with included "header files" I keep getting strange errors. I should mention that when I was compiling the files directly in visual studio c++, it was okay and it successfully compiled. The header files that results in error are from a Phantom Omni Haptic device library and are correct. I also should mention that I set the correct compiler using mex -setup in Matlab. Here is some part of the included header file and coresponding errors I got: program: ((Included Header file name : hdDevices.h)) Line 25) #include <HD/hdExport.h> Line 26) #include <HD/hdCompilerConfig.h> Line 27) #include <HD/hdDefines.h> Line 28) Line 29) #ifdef __cplusplus Line 30) extern "C" { Line 31) #endif Line 32) Line 33) /* Initialize the device. Must be called before any use of the device. Line 34) Makes the device current. */ Line 35) HDAPI HHD HDAPIENTRY hdInitDevice(HDstring pConfigName); Line 36) Line 37) /* Makes the specified device current: all future calls will be performed on Line 38) this device. Requires a valid device id from an initialized device. */ Line 39) HDAPI void HDAPIENTRY hdMakeCurrentDevice(HHD hHD); Line 40) Errors ----> C:\Program Files\MATLAB\R2012b\simulink\include\HD/hdDevice.h(35) : error C2146: syntax error : missing ';' before identifier 'HHD'...

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...

Matlab v7 data file in Matlab v6.5
Hi there I want to save my data into data file in Matlab v7 (R14). How can I save it in a manner such that it is also loadable in Matlab v6.5 (R13) ? As at the moment, Matlab v6.5 interprets a Matlab v7 saved data file as a corrupt file. Thanks in advance, rehan Rehan Ahmad wrote: > > > Hi there > > I want to save my data into data file in Matlab v7 (R14). How can I > save it in a manner such that it is also loadable in Matlab v6.5 > (R13) ? As at the moment, Matlab v6.5 interprets a Matlab v7 saved > data file as a corrupt file. > > Thanks in advance, > reh...

Why is Matlab 7 excruciatingly slow (compared to Matlab 6)?
Hi, I've just installed Matlab 7 and it's incredibly slow when starting up and also when closing. Once the Matlab program window opens, it looks like as if it has started but it says "Initilizing..." in the Status bar at the bottom and the Start button is disabled. Basically you can't do anything. I never had such problems with Matlab 6. Don't have any virus program running either. Is there any setting I need to adjust to prevent this from happening? Cos it takes nearly 2-3 mins just to complete initialization!! I tried installing it on two notebooks and they both ...

Matlab slows down after apeending to a file
Dear all, I am using matlab R2010b, 32bit version to 1) query a device and 2)store those results to hard disk. That device, actually is a measurement devices, every one second "feeds" matlab with 256kbytes of data (32.000 number of double precision). I am appending those measurements to a file and for reducing the extra burden I write those numbers fwrite(fileID, DataToWriteToFile, 'float32') as float32. After few days the size of the file increases in size (i.e 20Gb after 3 days of non stop getting n storing measurements into a file) and it looks like that the ma...

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, ...

adding some of the files from Matlab central to the offical Matlab releases?
I see some very useful files and commands at Matlab central, and wonder why Mathworks does not add these to the official Matlab release? This will make using these files/commands easier, so that, for example, when sending an .m file to someone, they do not have to go download some additional files from matlab central first to the code. Just for an example, there is the GUI layout manager toolbox http://www.mathworks.com/matlabcentral/fileexchange/27758-gui-layout-toolbox And the factorize() and inverse() commands in http://www.mathworks.com/matlabcentral/fileexchange/24119 ...

Run Matlab ... from Matlab
Hello, Is there any limitation to run Matlab from Matlab, as a system command, on Linux platforms ? I tried to start Matlab, both using the ! syntax (!matlab&) or the system command (system('matlab&')), the Matlab splash screen appears, but the new Matlab session closes rapidly . When I do the same with a script of mine (system('matlab -r "myscript"&')), my script is being executed, but Matlab finally crashes . If I remove the &, it works well, but the first Matlab session is blocked till I close the second one . I run Matlab on a Linux 64bits platform . Thanks in advance, Nicolas On 10-12-03 01:22 AM, Nicolas wrote: > Is there any limitation to run Matlab from Matlab, as a system command, > on Linux platforms ? > I tried to start Matlab, both using the ! syntax (!matlab&) or the > system command (system('matlab&')), the Matlab splash screen appears, > but the new Matlab session closes rapidly . > When I do the same with a script of mine (system('matlab -r > "myscript"&')), my script is being executed, but Matlab finally crashes . > If I remove the &, it works well, but the first Matlab session is > blocked till I close the second one . > I run Matlab on a Linux 64bits platform . It appears there is a parsing problem in the script that invokes Matlab. Here's an example of what I had to do to get around it: !matlab -r \""...

Call Matlab m-file from Matlab Scrip Node
My problem with matlab script node is related to calling function in matlab.&nbsp; I created an m-file function that takes an imput temperature (from DAQ) and defines a material property.&nbsp; My matlab script node doesn't seem to recognize my function.&nbsp; I have placed the function in the folder the vi is currently located, but it doesn't read it.&nbsp; How do I get matlab script node to read the functions I create in matlab? Add the directory to matlab path, or call the .m file with it full name ( D:\..... \myfile.m) Let me clarify, &nbsp; I have pasted my m...

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...

Web resources about - Mex File Slows Matlab - comp.soft-sys.matlab

Undocumented Matlab
Undocumented, unsupported and hidden features in Matlab

Matlab Upazila - Wikipedia, the free encyclopedia
... 23°21′N 90°42.5′E  /  23.35°N 90.7083°E  / 23.35; 90.7083 Coordinates : 23°21′N 90°42.5′E  /  23.35°N 90.7083°E  / 23.35; 90.7083 Matlab ...

Open Directory - Science: Math: Software: MATLAB
The MathWorks - Developers of MATLAB, Simulink and Stateflow. Offers products for data analysis, visualization, application development, simulation, ...

MATLAB Mobile on the App Store
Read reviews, compare customer ratings, see screenshots, and learn more about MATLAB Mobile. Download MATLAB Mobile and enjoy it on your iPhone, ...

The Smart Emergency Response System Using MATLAB and Simulink - YouTube
In the aftermath of an earthquake, every second counts for disaster victims. Imagine a system that can locate people quickly and help first responders ...

The A-Z of Programming Languages: MATLAB
What prompted the development of MATLAB?

Matlab: Invalid .NET Framework. Either the specified framework was not found or is not currently supported ...
If you are trying to compile Matlab into .Net framework, you might encounter this message, even though you have the .Net framework installed ...

Matlab edges closer to electronic design automation world
Matlab, one of the world's most widely used products for algorithmic development, has long occupied its own niche far removed from EDA and hardware ...

Can I/How do I use DMTCP with a parallel pool of MATLAB workers? · Issue #223 · dmtcp/dmtcp · GitHub
dmtcp - DMTCP: Distributed MultiThreaded CheckPointing matlab -nodisplay -r "parpool('local',4); parfor i=1:10, pause(1); fprintf('%i ',i); end; ...

Using MATLAB and SDR to Reverse Engineer 433MHz Messages
... so he focused on studying the methodology and the tools available for analyzing 433MHz RF transmission. He describes the process of using MATLAB ...

Resources last updated: 3/13/2016 2:38:19 AM