Answered
Undefined function 'eq' for input arguments of type 'struct'
Does this do what you want? if( isempty(s) )

10 years ago | 0

| accepted

Answered
Monte Carlo Method to Estimate Pi
First look at the doc for rand to see how to generate random numbers between -1 and 1: http://www.mathworks.com/help/matlab/r...

10 years ago | 0

Answered
Matrix Division of two 4x1 matrices to get a 4x4 matrix
In general there will be no unique solution for M if the only thing you have to start with is S and Sprime. If you think about i...

10 years ago | 1

| accepted

Answered
How a 4D and 5D matrix or array look like? Can we say that a 4D array is another for of 3d or reshaping the 3d matrix in a bigger 3d matrix. Please reply soon.
You could say: A vector is an array of scalars. A 2D matrix is an array of vectors. A 3D array is an array of 2D matr...

10 years ago | 1

Answered
index must be a positive integer or logical
What are the values of the x vector? E.g., is x(1) equal to 0? This could cause the error.

10 years ago | 0

Answered
[DISCONTINUED] MATLAB Answers Wish-list #4 (and bug reports)
I would like power-users to have the ability to conditionally accept an Answer during the initial 7-day wait period. There have ...

10 years ago | 4

Answered
Create matrix from order of numbers from binary matrix
Caution: Untested x = your matrix of 1's and 0's, xt = x'; s = sum(x(:)); n = numel(x); g = logical(xt); xt(...

10 years ago | 0

| accepted

Answered
I've got a series of numbers ranging from 2 to 50. How can I make matlab make a calculation for each value and put the results as another column right next to it?
E.g., x = [1;2;3;4;5;6]; % <-- Use ; separator to make column vector y = [x,10./x]; % <-- Use element-wise division oper...

10 years ago | 0

| accepted

Answered
Runge-Kutta - Orbital mechanics application
I haven't checked all of your code in detail (and I haven't checked *any* of your orbital mechanics equations at the front), but...

10 years ago | 0

Answered
Finding small vector in big vector
I am not on a machine with MATLAB at the moment to test this, but maybe try the strfind(x,y) function to see if it works with do...

10 years ago | 1

Answered
Convert BIN to HEX
doc fopen doc fread doc dec2hex

10 years ago | 0

| accepted

Answered
How to pull an item and save it into an array/matrix from a Cell that is composed of a Struct
pull(i) is likely a scalar, while myVar{i}.myStruct.myPullItem is likely not a scalar. You are trying to stuff multiple values i...

10 years ago | 0

Answered
Creating sparse matrix in MEX
First, this line is incorrect: A=(double **) mxCalloc( M, sizeof(double)); It should be one of the following instead: ...

10 years ago | 0

| accepted

Answered
??? Error using ==> mtimes Integer data types are not fully supported for this operation. At least one operand must be a scalar.
Generic matrix multiplication for integer data types is not supported by MATLAB. You will need to convert them to a floating po...

10 years ago | 0

| accepted

Answered
calling matlab from c++
Use regular output functions. E.g., ( *after* you assign the value of cresult but *before* you destroy the mxArray mresult ): ...

10 years ago | 0

| accepted

Answered
Get distance covered by a wheel using a gyroscope placed on it
What exactly is in the Gyr_Z1 vector? Are these raw values coming from the gyro? Are they counts? Have they been scaled so that...

10 years ago | 0

Answered
how to fit an array in matrix?
What are the sizes involved? E.g., are you trying to insert a row at the front? E.g., is this what you want (assumes same number...

10 years ago | 0

Answered
Matlab crashes when a C mex file is called
A few observations: unsigned short *hx; : hx = mxGetPr(prhs[0]); The above code will only wo...

11 years ago | 0

Answered
Newton's Method Question
Some hints (I leave it to you to insert them properly into your code): I assume the function handle and function derivative h...

11 years ago | 0

Answered
How do I exclude data coordinates from a preexisting array?
E.g., use logical indexing to isolate the points you want to plot. g1 = data(:,2) < .5 * data(:,1) + .45; % Points less tha...

11 years ago | 0

| accepted

Answered
how to convert output to integer?
Use %d instead of %x for the output format.

11 years ago | 0

Answered
Swapping values within a vector if the one after it is greater than the one before it.
To do the swap you could just use a two-element index vector. E.g., if x(k) > x(k+1) x([k,k+1]) = x([k+1,k]); ...

11 years ago | 1

Answered
How can I get a variable name from a cell?
Once the variable has been put into a cell, you can't recover the original variable name from the cell. If you need that informa...

11 years ago | 0

Answered
using C++ Library (SeqAn) in MATLAB
E.g., You can use the following functions: libfunctions --> Lists the functions available to call calllib --> Calls ...

11 years ago | 0

Answered
Subscripted assignment dimension mismatch.
The result of the find is likely a vector, and it appears you are trying to stuff this vector into a scalar spot. Do you need a...

11 years ago | 0

| accepted

Answered
File with a NaN (wavelet)
To replace NaN values with 0's in a variable X: X(isnan(X)) = 0;

11 years ago | 0

Answered
mex file related.....
If the only thing you have is the mex dll routine (i.e., the mex function itself), then you _cannot_ do this in general because ...

11 years ago | 0

Answered
How to use for loops to calculate the determinant of the first n powers of 2x2 matrix (A) without using the implicit Matlab command "det"
To calculate the determinant of a 2x2 matrix, see this link a little over halfway down the first page: http://mathworld.wolfr...

11 years ago | 0

Answered
Filling up a matrix
How about a simple loop: result = zeros(13,69); for k=1:69 n = numel(mycellarray{k}); result(1:n,k) = myce...

11 years ago | 1

Answered
How to test for integers and delete integers that do not perform to the test
Hint: Take a look at the result of rem(A,1)==0. What do you get if you sum this up?

11 years ago | 1

Load more