Answered
Assign a vector to a cell element
c{3} = v;

10 years ago | 0

| accepted

Answered
"Error using zeros" maximum variable size allowed by the program is exceeded
A matrix of size 2^57 x 57 doubles would take about 6.57e19 bytes of memory ... way way more than your computer has available. S...

10 years ago | 2

Answered
If statement using the value in the row before
You probably started the loop with i=1. When i=1, the i-1 index evaluates to 0, hence the error. Start your loop at i=2 instead...

10 years ago | 0

| accepted

Answered
How can I multiply two matrices of difference size
Use the "dot" version of the operators to do element-wise multiplication and division. E.g. v = q .* (sqrt((w))); Pressu...

10 years ago | 1

| accepted

Answered
How to draw a line from a point A(x1,y1,z1) to B(x2,y2,z2) ?
plot3([x1 x2],[y1 y2],[z1 z2]) grid on

10 years ago | 0

Answered
how to remove unwanted zeros from a vector
v = [ 0 0 0 0 4 5 6 0 0 0 9 9 8 7 6 0 0 0 0 0 0 3 4 4 0 0 0]; d = [1 diff(v)]; % 0's indicate when the value didn't cha...

10 years ago | 1

| accepted

Answered
How to turn multiple outputs into a array
Assuming Rate_overtime is a function that outputs a double scalar, you could do this: Rate2Graph = zeros(1,N); for n=1:N...

10 years ago | 0

Answered
Too many input arguments error
It is not clear what "testset" is, but if it is a cell array then the notation you are using in your TestNetwork call will produ...

10 years ago | 0

| accepted

Answered
Error with ode45 when solution approaches 0
You've got a 3D 2nd order problem defined (orbit in 3D space), but you are calling ode45 as if you only had a 1D problem to solv...

10 years ago | 1

| accepted

Answered
Generating a random number inside a function decleration
Is your rand method even valid for arbitrary size time steps and the intermediate derivatives that ode45 is using internally? T...

10 years ago | 1

Answered
Using cos function in matrix leads to invalid input character
You have special unprintable characters between the "cos" and the "(" characters, and between the "sin" and the "(". You need to...

10 years ago | 0

Answered
mtimesx library compile error
TMW changed the way the mex function operates a couple of years ago. Unfortunately at that time I did not have access to recent ...

10 years ago | 1

Answered
Draw random variables student t distribution
See these links for a description: http://www.mathworks.com/help/stats/trnd.html http://www.mathworks.com/help/stats/stude...

10 years ago | 0

Answered
Use mex file (mexw64 ormexw32 extension) from Matlab 2011b to Matlab 2015b
mex routines, in general, are not guaranteed to be compatible between different versions of MATLAB. Sometimes you get lucky and ...

10 years ago | 0

Answered
Field assignment to a non-structure array object.
When the line "p.MarkerSize = bins" is reached, p is a pre-existing variable that is not a struct. So attempting to treat it as ...

10 years ago | 2

| accepted

Answered
Efficiently Deleting Matrix Columns/Rows
The above code still works fine for me in R2015a Win32. Maybe you might change the mwSize to size_t, but unless the dimension is...

10 years ago | 2

| accepted

Answered
How can I get the min/max value of a particular matrix field over all structures of a cell array
data_struct = [data{:}]; data_v = [data_struct.v]; result = min(data_v(2,:));

10 years ago | 0

| accepted

Answered
Matlab Binary Parsing and Type Casting Speedup
One issue is that the lines you highlight are basically data copying. I.e., you copy the data to pick out the segment, then you ...

10 years ago | 1

| accepted

Answered
Hi, When I try to to generate a mex files w.r.t to C code , I'm facing an linking error.
The error message basically says that you don't have the entry function "mexFunction" anywhere in your code. I.e., you don't ha...

10 years ago | 0

Answered
Error: "Not enough input arguments. Error in f (line 2) y = (x.^3) - 2." I also want to verify that this code is using the bisection method to estimate a zero until two successive estimates have a diff. less than 10-6.
You need to have two files for this. One for your function that you intend to find the root of. And another for the script to d...

10 years ago | 0

| accepted

Answered
quaterions to string in matlab
I still don't know how your quaternions are stored. Maybe a class object? However, one thing you might try is converting it to a...

10 years ago | 0

| accepted

Answered
create sparse upper triangular matrix with only 1s
A sparse version of the full triangular matrix will have slightly over 1/2 of the values, plus some extra overhead for the expli...

10 years ago | 1

| accepted

Answered
Connect LeapMotion to Matlab (using C Code or mex files)
If you don't want to go the mex route, and you have library dll's of the functions you want to use, you might try loadlibrary an...

10 years ago | 0

Answered
Is there a data type has higher precision than double?
You can use the Symbolic Toolbox VPA http://www.mathworks.com/help/symbolic/vpa.html?searchHighlight=VPA Or you can use th...

10 years ago | 0

Answered
Calcul Speed, Position by acceleration with an accelerometer
Well, what you are currently calculating are *changes* in velocity and *changes* in position, i.e. delta-v and delta-p. To do g...

10 years ago | 0

Answered
How is matlab using 60% of my CPU?
Without looking at your code in any detail I will offer this comment. Many MATLAB functions (such as matrix multiplication, ele...

10 years ago | 0

Answered
Can I check that is the output variable same as input variable in mex?
You don't have enough information available (officially) to do what you are trying to do reliably and safely in a mex routine. ...

10 years ago | 1

| accepted

Answered
How do I shorten this code to remove one piece of information from each submatrix?
E.g., to extract the (1,1) element of each cell: A = cellfun(@(x)x(1,1),Mcell); For the (2,1) element, A = cellfun(...

10 years ago | 1

Answered
Function masking / precedence of functions
You could try the following: Run your code from a special directory that does *not* contain any of the functions you want to ma...

10 years ago | 0

| accepted

Answered
Average certain rows in 3D matrix
Is this what you want? rows = [4 5 6 9 11 17 28 38 43 50 57]; Y = mean(X(rows,:,:),1);

10 years ago | 0

Load more