Answered
Attempted to access x(5); index out of bounds because numel(x)=4.
The error is caused by ii iterating from 1 to 4, but you use ii+1 (=5 at last iteration) as an index into the x and y vectors wh...

10 years ago | 0

Answered
Fastest way to cycle through a structure for a number
result = find([structure.val]==value); E.g., >> structure(1).val = 50; >> structure(2).val = 47; >> structure(3)...

10 years ago | 0

| accepted

Answered
Parallel Processing An Array/Array Appending
Can you save up all of the arrayToAdd stuff in a cell array and then cat all the results at once at the end to minimize the data...

10 years ago | 0

Answered
how to put output of a function in diagonal of matrix
If y is a vector, then simply y = diag(y); If y is a matrix and you are trying to pick off the diagonal, then e.g., ...

10 years ago | 0

| accepted

Answered
GPS Time conversion from uint8 to decimal
Can you use either of these? >> u = uint8([65 31 163 67 100 90 28 172]) u = 65 31 163 67 100 90 28 172 ...

10 years ago | 0

Answered
\matlab\extern\include\matrix.h(604) : error C2143: syntax error : missing ')' before 'constant',what happen to this ?
Can you compile a bare bones file? E.g., #include "mex.h" void mexFunction(int nlhs, mxArray *plhs[], int nrhs, mxArray ...

10 years ago | 0

Answered
table variable name based on array
Do you mean like this: c.(colnames{1}) = a; c.(colnames{2}) = b;

10 years ago | 0

| accepted

Answered
Subtracting every other row
B = A(3:2:end,1) - A(2:2:end,1);

10 years ago | 0

| accepted

Answered
How to add an array in a structure as a new field?
E.g., c = num2cell([stats.MinorAxisLength]./[stats.MajorAxisLength]); [stats.Ratio] = c{:};

10 years ago | 0

| accepted

Answered
LAPACK error: info -5
BLAS and LAPACK are the math libraries that MATLAB uses for linear algebra. zgeev is the name of one of the routines in the LAP...

10 years ago | 1

| accepted

Answered
Get Equation as Input from User (str2func)
E.g., see this link: http://www.mathworks.com/matlabcentral/answers/297425-could-i-use-a-function-of-x-as-input-like-this-fun...

10 years ago | 1

Answered
Could I use a function of x as input like this ( fun = input(' Function of x = ');) and then when I run the program insert a function of x ?
E.g., input your function as a MATLAB syntactically correct string, then use the str2func function to form a function handle. E....

10 years ago | 2

| accepted

Answered
Set and get structure field with invalid name
I would start with this if you are trying to get stuff from a mat file: http://www.mathworks.com/matlabcentral/fileexchange/4...

10 years ago | 0

Answered
ODE45 and 3D arrays
1) Don't use (:,:,k) subscripting on Phi in your derivative function. ode45 only knows about Phi as a 36-element column vector....

10 years ago | 1

| accepted

Answered
How to convert a 4D matrix from Matlab to C++
C array storage order is reversed from MATLAB storage order. This holds regardless of the number of dimensions. And you certainl...

10 years ago | 0

| accepted

Answered
reading binary file but Hex corresponds to a float
E.g., to convert hex characters to a single float that matches your expectations: >> typecast(int32(hex2dec('42117B5C')),'s...

10 years ago | 0

Answered
compatibility of MEX TYPE for Matlab 2007b and visual studio 2008
LCC is a C compiler only, not a C/C++ compiler combo like Visual Studio et al. To get C++ you have to install a separate C++ co...

10 years ago | 0

| accepted

Answered
Weird error on mex compilation
First, get your mexFunction signature correct and try compiling again. Then we can work on other errors. So first change this: ...

10 years ago | 0

Answered
image flipping without built in commands
Did you mean this? newcat(1:row,1:col,:) = cat(row:-1:1,1:col,:); Or this? newcat(1:row,1:col,:) = cat(1:row,col:-1...

10 years ago | 0

Answered
how to duplicate data length of a workspace ?
E.g., assuming N is divisible by 4: result = repmat(column_vector,N/4,1); If you have to cover cases where N is not divi...

10 years ago | 0

Answered
mex: Link Failed when compile C file
You typically do *not* include header .h files in a mex command. They are generally intended to be included in the source file ...

10 years ago | 1

Answered
Fortran MEX using Cell arrays - crashing Matlab..
You are not creating any output cells, so you are writing to garbage address locations which will eventually result in a MATLAB ...

10 years ago | 0

Answered
How to find non-zero indexes (or value) in row in matrix, and make taken results i and j elements of another matrix Dij?
E.g., using a loop: m = size(A,1); result = zeros(m,1); for k=1:m x = find(A(k,:)); for n=2:numel(x) ...

10 years ago | 1

| accepted

Answered
Is there any means to overload '* (multiplication by the transpose matrix) with my own matrix class?
You could create a special method for this. E.g., tmtimes. Then instead of doing y = A'*x you would do tmtimes(A,x). Or you ...

10 years ago | 0

| accepted

Answered
How to multiply each elements of single matrix one-by-one?
This will multiply every element by every other element: result = Xij(:) * Xij(:)'; % <-- Simple outer product of all the ...

10 years ago | 0

| accepted

Answered
Calculation of Enormous Numbers
Another way: digits 500 Z = vpa(2)^1000 Or see John D'Errico's submissions in the FEX: http://www.mathworks.com/ma...

10 years ago | 0

| accepted

Answered
just installed the Matlab2016b pre-release, do I need to uninstall the previous version (2015b)
No. Multiple versions of MATLAB can co-exist on the same system. Only one of these versions will be the "default" version for ru...

10 years ago | 0

Answered
what is meaning of this error : Undefined operator '*' for input arguments of type 'struct'
It means you tried to use the matrix multiply operator on a struct. E.g., >> a.x = 1:3 a = x: [1 2 3] >> b.y ...

10 years ago | 0

| accepted

Answered
How to return all the rows of a matrix into variables?
variance = diag(w*var_cov*w')

10 years ago | 0

| accepted

Answered
How do I input 2x*sech^2(x^2 - 9) into MATLAB
E.g., vectorized form: y = 2 * x .* (sech(x.^2 - 9)).^2;

10 years ago | 0

| accepted

Load more