Answered
Multiple inputs into for loop
E.g., to vary them at the same time numPixelSpinefromPhan = [2688.00 3619.00 4306.00 4009.00 5029.00 5224.00 4151.00 2518.0...

9 years ago | 0

| accepted

Answered
Multiply each column in MxN matrix with it's transpose to create MxMxN matrix
X = your MxN matrix [M,N] = size(X); Xcols = reshape(X,M,1,N); Xrows = reshape(X,1,M,N); result = bsxfun(@times,Xc...

9 years ago | 0

Answered
i am being asked to solve a problem by eulers method
See Euler's Method here: https://en.wikipedia.org/wiki/Euler_method Look at the examples. An outline to get you going on ...

9 years ago | 0

Answered
how can I increment 2 variables in a for loop at the same time?
There are several ways to achieve this. E.g., I = some range J = some range for k=1:numel(I) i = I(k); ...

9 years ago | 4

| accepted

Answered
Computing the pairwise distance matrix given a matrix of vectors
doc pdist e.g., result = squareform(pdist(vectorMatrix')); or drop the squareform if you are willing to do your own...

9 years ago | 1

| accepted

Answered
Using horzcat in a loop for combining large number of files
data_all= reshape(data,size(data,1),[]); Or, if you needed to vertcat them instead, then you could use result = reshap...

9 years ago | 0

| accepted

Answered
How to execute a function which has the same name as another variable?
The bottom line here is probably "don't do that" in your code. This is similar to using eval( ) or load( ) to pop variables int...

9 years ago | 0

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

Load more