Answered
Questions regarding preallocation and much more
The problem here is that the shape of the output and the algorithm determine the number of times the array needs to be reallocat...

10 years ago | 0

Answered
Returning mxArray* as void* from a C shared library
Passing mxArrays via void pointers is likely to cause problems in your code (memory leaks and crashes). The calllib code has sp...

10 years ago | 0

| accepted

Answered
loadlibrary mfilename put in sub folder
The thunk file can be placed anywhere by adding the thunkfilename option with a path to the desired location. The only way to c...

10 years ago | 1

| accepted

Answered
Share Library works but is unstable
You are going to have to debug this yourself. Some suggestions: # Don't unload the library. Unloading a c or c++ library do...

10 years ago | 0

Answered
Using c-files in Matlab
If these c files are already a library of functions and you wish to use more then one of them from MATLAB then make a shared lib...

10 years ago | 0

| accepted

Answered
Is it possible to change the 'ClockPrecision' setting of MATLAB's Profiler?
The ClockPrecision is based on the timer used, change the profile timer source for a different precision. If you have access to...

10 years ago | 1

Answered
How to Load Multiple dll files that have one header
You need to call loadlibrary three times. It will be faster if you create a prototype file the first time or even do it once an...

10 years ago | 0

| accepted

Answered
memory leak from mex file in R2012a?
Most likely the problem is in the specific mex file. There are no systematic leaks with mex files in any recent version of MATL...

10 years ago | 0

Answered
Matlab efficiency - Pass by reference
Does R.Struct1 contain objects (especially handle objects) or data that could be in other objects? Of particular concern is any...

10 years ago | 0

Answered
Safe memory management when interfacing code via MEX
Locking the mex file is only needed to preserve static data. Any memory allocated using malloc or new will persist until delete...

10 years ago | 0

| accepted

Answered
Memory leak when calling DOS command in a loop
Best guess is that your executable is not exiting cleanly or at all. Check task manager for a large number of some process. Mo...

10 years ago | 0

Answered
loadlibrary issue with dll
These lines of code : typedef unsigned __int8 u08; Are making use of a Microsoft extension to the c language ( |__int8...

10 years ago | 1

| accepted

Answered
loadlibrary issue with dll
I do believe the problem is a missing header. The |addheader| loadlibrary option is NOT the solution by itself. Start with a c...

10 years ago | 0

Answered
Do Matlab structures leak memory?
This is not a leak and has nothing to do with Java heap. This code is not using the Java heap. The problem is that you are...

10 years ago | 0

Answered
mex code did not give improvements as compraed to matlab code
I will hazard a guess that your performance problem is the allocation of data inside your for loops. Allocating memory is slow ...

10 years ago | 0

Answered
How Do I use Mexcallmatlab to Call a User-defined function?
This will not work. MATLAB and mexCallMatlab are not thread safe, there is no way to call a MATLAB function from an OpenMP for ...

10 years ago | 0

Answered
mpi affecting matlab execution speed
Could the problem be a power savings setting? Many machines are now configured to run at a lower clock rate when not heavily l...

10 years ago | 3

| accepted

Answered
Debug-mode compilation in Windows uses release-mode C and C++ standard libraries
Mex files have always been built and linked against release versions of the libraries to avoid conflicts caused by mixing releas...

10 years ago | 1

Answered
Given a named function, how can I call this function, and not the subfunction of the same name?
There is a much simpler solution to this: function fh=test fh=str2func('@(x) help(x)'); fh('help') end ... ...

10 years ago | 2

Solved


Make a checkerboard matrix
Given an integer n, make an n-by-n matrix made up of alternating ones and zeros as shown below. The a(1,1) should be 1. Example...

10 years ago

Answered
64 Bit version of Matlab 2015a a lot slower than 32bit version
Two things to look into: Independently (of MATLAB) check the machines performance. And also post bench results from the same...

10 years ago | 0

Answered
Why does profiler include idle time?
This is a bug/feature in recent versions of the profiler through R2015a. On Mac/Linux the profiler times with processor time b...

10 years ago | 0

| accepted

Answered
LoadLibrary, enums, and character literals
This is a bug/limitation in the perl script that parses the header file. Because the perl script works from a pre-procesed hea...

10 years ago | 1

| accepted

Answered
Can I use Matlab Profiler on a compiled DLL
The profiler is not available in compiled code. You will need to make a driver program in MATLAB that can call your code or use...

10 years ago | 0

Answered
Toc returns loop time instead of total script time
Clear all and clc will not clear tic time. There must be another call to tic. For this reason I recommend always using the...

10 years ago | 0

Answered
Has Matlab 2013b and newer fixed the memory leak issues in pause and delete?
You could say they were fixed but that would not explain the whole situation. The pause "leak" was a message queuing and gr...

11 years ago | 1

| accepted

Answered
matPutVariable() -> matrix::serialize::WrongSize at memory location
First-chance exceptions are frequently normal. If you were to debug MATLAB you would see many thousand first chance exceptions....

11 years ago | 1

Answered
Is there anyway to check what functions are defined in a mex file?
By definition A standard mex file only only has one function available to MATLAB named the same as the mex file and implemented ...

11 years ago | 1

Answered
Cannot debug mex file with Microsoft Visual C++ 2013 Professional
I see two possible issues. The first is that Visual Studio is attached to MATLAB as 'Managed' note the select button in your f...

11 years ago | 2

| accepted

Answered
matPutVariable fails in matcreate.cpp for matlab2014b on windows 8
First thing to do is check that your matcreate.exe is using zlib1.dll supplied with MATLAB and not one from another package. Yo...

11 years ago | 1

| accepted

Load more