Respondida
How do I convert from a while loop to a for loop?
for i=0:11:109 fprintf('i = %d\n',i) end

casi 11 años hace | 2

| aceptada

Respondida
How can use "is not equal to" command in matlab? and how terminate or cancel if else??
E.g., if( length(a) ~= length(b) || length(c) ~= length(a) ) % terminate end For the terminate statement, you ...

casi 11 años hace | 0

| aceptada

Respondida
"depth" of mexMakeArrayPersistent ?
Repeated from this link: http://www.mathworks.com/matlabcentral/newsreader/view_thread/343079 Persistence of mxArray varia...

casi 11 años hace | 1

| aceptada

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

casi 11 años hace | 0

| aceptada

Respondida
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...

casi 11 años hace | 0

Respondida
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...

casi 11 años hace | 1

| aceptada

Respondida
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...

casi 11 años hace | 1

Respondida
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.

casi 11 años hace | 0

Respondida
[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 ...

casi 11 años hace | 4

Respondida
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(...

casi 11 años hace | 0

| aceptada

Respondida
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...

casi 11 años hace | 0

| aceptada

Respondida
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...

casi 11 años hace | 0

Respondida
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...

casi 11 años hace | 1

Respondida
Convert BIN to HEX
doc fopen doc fread doc dec2hex

casi 11 años hace | 0

| aceptada

Respondida
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...

casi 11 años hace | 0

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

casi 11 años hace | 0

| aceptada

Respondida
??? 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...

casi 11 años hace | 0

| aceptada

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

casi 11 años hace | 0

| aceptada

Respondida
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...

casi 11 años hace | 0

Respondida
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...

casi 11 años hace | 0

Respondida
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...

casi 11 años hace | 0

Respondida
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...

casi 11 años hace | 0

Respondida
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...

casi 11 años hace | 0

| aceptada

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

casi 11 años hace | 0

Respondida
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]); ...

casi 11 años hace | 1

Respondida
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...

casi 11 años hace | 0

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

casi 11 años hace | 0

Respondida
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...

casi 11 años hace | 0

| aceptada

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

casi 11 años hace | 0

Respondida
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 ...

casi 11 años hace | 0

Cargar más