Answered
out of memory in perms.m
Probably because you used too large of a number. E.g., >> perms(1:3) ans = 3 2 1 3 1 2 ...

9 years ago | 1

Answered
Convert binary to decimat
doc bin2dec

9 years ago | 0

Answered
Match Fields of two structs (without a loop if possible)
I don't think loops is such a bad way for this application. There will be some incremental data copying going on, but the only ...

9 years ago | 0

Answered
How can I add the elements of a smaller matrix in the elements of a bigger matrix at some specified locations ???
Another way: D = A; D(1:2,1:2) = D(1:2,1:2) + B; Or, if you don't know the size of B in advance or where you want it ...

9 years ago | 0

| accepted

Answered
Faster alternative to find or logical indexing for specific problem
In case you go the mex route, here is a routine for you for the validIdx calculation: /* validIdx_mex.c * * B = val...

9 years ago | 0

| accepted

Answered
order of variable deletion and creation
I don't think this behavior is formally documented. My observations have been that the mxArray structure for "output" is retain...

9 years ago | 2

Answered
Minimizing a multivariable anonymous function that contains vectors using fminsearch
Make R2 accept a vector input. E.g., use x as the argument and replace I0 with x(1) and a with x(2) R2=@(x) (rBes(u)-x(1)*((...

9 years ago | 0

Answered
How important is the accurate specification of nnz for spalloc?
In general, undershooting is *much* worse than overshooting. With undershooting, if you go over the allocated amount by even 1 ...

9 years ago | 0

| accepted

Answered
need help about this error
The function detectCopyMove apparently takes more than two input arguments. Look at this function to determine what the require...

9 years ago | 0

Answered
Mex error: "error C2664: 'mxCreateNumericArray_730' : cannot convert parameter 2 from 'int [2]' to 'const size_t *'"?
The signature for mxCreateNumericArray is: mxArray *mxCreateNumericArray(mwSize ndim, const mwSize *dims, mxCl...

9 years ago | 1

| accepted

Answered
How to part a Matrix into submatrices based on the data
E.g., with results in a cell array: X = the 30000 x 5 matrix n = number limit for 3rd column result = cell(n,1); f...

9 years ago | 0

Answered
Can I load .mat files in a loop?
Another way: filenumbers = 120:129; % <-- or whatever number range you want for k=filenumbers S = load(['img' num...

9 years ago | 1

Answered
how to define a function
If you are getting this message: Error: Function definitions are not permitted in this context. It means that you cannot...

9 years ago | 0

Answered
From a string to function handle of a function handle
func2 = eval(tmp);

9 years ago | 0

| accepted

Answered
Pass complex number to shared library
I am not familiar with the use of libpointer, so I am just guessing here, but maybe for complex numbers you need to arrange the ...

9 years ago | 1

Answered
Multiple Conditions with if
MATLAB does not evaluate compound relational expressions like you are expecting. E.g., these lines if D(i,j)<y(i,j)<G...

9 years ago | 0

| accepted

Answered
Matlab Engine for C - Passing Arrays
In addition to what Jan has written, you will want to destroy the mxArray variables after using them in myFun so you don't have ...

9 years ago | 0

Answered
For loop data into 21X21 matrix.
E.g., a basic outline: M = number of rows N = number of columns result = zeros(M,N); % pre-allocate result for n=...

9 years ago | 0

| accepted

Answered
Values equal to zero in matrix
E.g., if you want to test for that condition within the loop itself: if( input_data(j,3) ~= 0 ) prediction(j,1) = cu...

9 years ago | 0

Answered
how to convert matrix with arrays into vector
Looks like you are working with a sparse matrix. To get the non-zero values into a column vector you could do this: S = yo...

9 years ago | 0

| accepted

Answered
How to loop a process and end when cell array is empty?
Something like this? while( true ) % Your code goes here if( isempty(raw) ) break; end e...

9 years ago | 1

| accepted

Answered
How to plot this equation y=exp(-(K-1))
doc ezplot

9 years ago | 0

Answered
How can I write this function handles in MatLab: f(x)= trace(CA^(x)VA^(x)') + sum_{i=1 to x}(trace(CA^(x-i)WA(x-1)')) - mu ?
For something like this, it would probably be best to just create an m-file to do the calculations, and then create a function h...

9 years ago | 0

Answered
How to remove rows from cell array based on multiple conditions?
E.g., assuming your columns are nice and are not mixed class: C = your cell array S = your cell string compare array, e....

9 years ago | 0

| accepted

Answered
How to convert matlab code to C code?
See this link about the MATLAB Coder: https://www.mathworks.com/help/coder/index.html

9 years ago | 0

| accepted

Answered
How to replace a row in one matrix with a particular row from a different matrix
Something like this maybe does what you want: A = your large matrix B = your smaller matrix [y,x] = ismember(B(:,1),A...

9 years ago | 1

| accepted

Answered
The most efficient way to add a new column or new row to a sparse matrix
In general, every time you significantly change the size of a sparse matrix (so that you exceed the current nzmax of the matrix)...

9 years ago | 1

| accepted

Answered
why this code is not running ? the workspace remains empty.
Once flag gets set to 1, you don't ever reset it to 0 so you effectively disable the rest of your code and count ceases to incre...

9 years ago | 0

| accepted

Answered
How to transpose image and use permute instead?
Transpose the first two indexes: Eleven3 = permute(Eleven3,[2 1 3]);

9 years ago | 0

| accepted

Load more