Answered
find the minimum of a matrix
[val idx] = min(X(:,j)); idx will be the row number.

12 years ago | 3

| accepted

Answered
Big integer and Precision
In addition to the Symbolic Toolbox, for extended precision integer and floating point arithmetic, you can use these FEX submiss...

12 years ago | 1

Answered
Build huge matrix with vector components
One way: c1 = ones(n,1)*(1:m); c2 = (1:n)'*ones(1,m); pos = [0 0; c1(:) c2(:)]; Or a similar method using repmat: ...

12 years ago | 1

Answered
Adding elements of an infinite matrix
You can't use a numeric summation process to see if an infinite sum converges or not. One good example of this is the harmonic s...

12 years ago | 0

Answered
how to make a loop ??
You could use something like this for your outer loop of making variable selections: patterns = dec2bin(0:7); for k=1:...

12 years ago | 1

Answered
Use system to run a program in Matlab
You have inadvertantly used curly braces in the formation of your string, which has turned the entire result into a cell array. ...

12 years ago | 1

Answered
directly use results of function
This has been asked many time on this forum. MATLAB does not support indexing directly into a function result. This is a restric...

12 years ago | 1

| accepted

Answered
Is the memory alignment by mxCalloc and/or mxMalloc defined
This topic has come up in the past. I believe the MATLAB API functions use malloc & friends in the background, and those functio...

12 years ago | 0

| accepted

Answered
use MATLAB function in C++
Yes. See this section of the doc on calling MATLAB functions from C/C++ using the Engine interface: http://www.mathworks.com/...

12 years ago | 1

Answered
What does parse error basically mean?
When did you get this error? In general, the term "parsing" refers to MATLAB reading an m-file (script or function) and translat...

12 years ago | 2

Answered
How to pick random numbers from an interval non-uniformly?
One method (assuming P1+P2=1): A = rand(N,1); I = A < P1; % indexes of the P1 set A(I) = A(I)*(pi/(2*P1)); % scale th...

12 years ago | 1

Answered
Remove for-loop by using cellfun
You can't avoid the for loop. Either it will be explicitly in your code, or whatever MATLAB function you use will have it in the...

12 years ago | 0

| accepted

Answered
Code Help for Matrix creation
A = (61312x2 matrix) B = (81x81 matrix) C = [A B(A(:,1)+81*(A(:,2)-1))]; % 3rd column uses linear indexing into B

12 years ago | 2

| accepted

Answered
How to put names of events in a listed vector?
Can you use a cell array of strings instead? E.g., {'event1','event345','event45', etc }. That way the strings do not need to be...

12 years ago | 0

| accepted

Answered
Loading mat files in matlab created from octave
If MATLAB can't load it, then I would guess that it was not written properly in Octave. Double check the way Octave is writing t...

12 years ago | 0

Answered
Calling mxFree crashes MATLAB if data is associated with mxArray.
When you do the following: mxSetData(A, a); what happens is the address contained in "a" is now part of the mxArray "A"....

12 years ago | 1

Answered
Determine number of bytes per element under program control
There *is* a mex function for this, mxGetElementSize, but it doesn't do you much good at the m-file level: http://www.mathwor...

12 years ago | 1

Answered
what is the difference between inv() and \ (the backslash) ?
In general, use backslash \ whenever possible. It will be more accurate. The inv() function has its uses when you need the expli...

12 years ago | 2

Answered
How to Load a class from file avoiding the set methods with empty arguments?
When you load a class object from a mat file, MATLAB must ensure that the object in the file matches the current definition of t...

12 years ago | 0

Answered
How do I save the entire workspace through an ode function call?
If A is not too large and you don't have too many iterations, you might consider just storing them in memory and then saving lat...

12 years ago | 0

Answered
calling mex file error
fulltosparse.F and loadsparse.F are Fortran source files, not C source files. You would need to select a Fortran compiler to mex...

12 years ago | 0

Answered
Why does the execution time of the same MATLAB code changes when I run it 2-3 times?
First, there is no such thing as "the exact execution time" of a piece of code in the sense you are talking about. Tic-toc retur...

12 years ago | 4

| accepted

Answered
Concatenate 3 bytes array of real time serial data into single precision
How is the data/number formatted in the 3-bytes? Is it a 24-bit signed integer using 2's complement encoding? Is it a 24-bit uns...

12 years ago | 1

Answered
A problem in running a MEX file in a consistent way
What code is in the loop? Are you sure you are not writing beyond the end of the data memory? What is the code after mexCallMATL...

12 years ago | 1

Answered
save one matrix to another but with different precision
MATLAB supports IEEE 64-bit double precision floating point numbers (the default for constant numeric) and IEEE 32-bit single pr...

12 years ago | 1

Answered
Is there any total solution for Matlab to work with visual C++ released after Matlab?
Unfortunately, The Mathworks is not in the habit of releasing mexopts files for older MATLAB releases when new compilers come on...

12 years ago | 1

Answered
How to run matlab executable c code file?
Not sure if it will make a difference, but try changing these lines: #include <matrix.h> #include <mex.h> to this: ...

12 years ago | 1

Answered
How can I label a solution as NaN in a MEX code?
Use the API function mxGetNaN: http://www.mathworks.com/help/matlab/apiref/mxgetnan.html?searchHighlight=mxgetnan E.g., to...

12 years ago | 0

| accepted

Answered
How can we encourage more thoughtful feedback on FEX submissions?
Maybe have a voting system in place for the FEX feedback similar to Answers. I.e., you get FEX feedback points if you provide so...

12 years ago | 1

Answered
MATLAB has encountered an internal problem and needs to close
This usually indicates a coding error in the mex routine itself. E.g., not checking for valid number of inputs or class of input...

12 years ago | 1

Load more