Respondida
Reading a .mat file in c/c++
Use the mat API functions from the library (e.g., matOpen, matGetVariable, etc): http://www.mathworks.com/help/matlab/read-an...

más de 10 años hace | 3

| aceptada

Respondida
Question on function variables i.e. ~
It is mainly to avoid cluttering your workspace with variables you don't need in a "neat" manner. E.g., [~,I] = max(abs(xc)...

más de 10 años hace | 1

Respondida
Matrix dimensions do not agree
My guess is you meant that division in your xinf calculation to be element-wise. E.g., change the / to ./ as follows: xinf ...

más de 10 años hace | 0

| aceptada

Respondida
'new' in MEX file causes crash
You don't show enough code. E.g., these lines: getMatrixSize(prhs[0], rows, cols, "rhs0"); getMatrixSize(prhs[1], rows...

más de 10 años hace | 0

Respondida
R2012b convert HEX to binary and extract individual bits
Is this all you are trying to do? bits01_05 = bin2dec(BinaryNumber(1:5)); bits06_06 = bin2dec(BinaryNumber(6:6)); bit...

más de 10 años hace | 0

| aceptada

Respondida
Get rid of unwanted output
You overwrite your input variable i with your for loop index i, which always goes up to 9. So do this instead: function out...

más de 10 años hace | 0

| aceptada

Respondida
what does it mean wcode=w64(1,:);
It means that at that point in the code, there is no variable in the current workspace with the name w64.

más de 10 años hace | 0

Respondida
Verify my For Loops
The reason you are getting all 7's in your answer is because i+j is always 7, so you are assigning 7 to each element. And the i...

más de 10 años hace | 2

| aceptada

Respondida
How can I use a vector value as a row index to modify an element?
Y = X; m = (1:size(X,1))'; % Generic row index vector g = bsxfun(@lt,m,V); % Logical indexes of the 0's Y(g) = 0; ...

más de 10 años hace | 0

Respondida
Specify compiler options for mex command
Maybe try some variant of the following: filename = your source code file name compiler_option = '/GL /fp:fast'; mex(...

más de 10 años hace | 1

| aceptada

Respondida
Deleting Rows of a Matrix HELP
When you delete rows in a for loop, the indexing changes so the for loop indexing is no longer valid. Instead of using a for loo...

más de 10 años hace | 0

| aceptada

Respondida
-3 + 5j in polar form
You could use the following: Z = -3 + 5j; R = abs(Z); theta = angle(Z); http://www.mathworks.com/help/matlab/ref/a...

más de 10 años hace | 0

Respondida
In an assignment A(I) = B, the number of elements in B and I must be the same.
t is a vector, so the expressions involving t that you have written will be vectors. You can't stuff a vector into a single elem...

más de 10 años hace | 0

| aceptada

Respondida
Function of a function\
x = a\b; doc mldivide http://www.mathworks.com/help/matlab/ref/mldivide.html?searchHighlight=mldivide

más de 10 años hace | 0

| aceptada

Respondida
result of ismember is wrong in my code correct in command window
I suspect this is just floating point issues. Reading from a file may read in all of the precision of the numbers (i.e., precis...

más de 10 años hace | 0

| aceptada

Respondida
'Not equal too' statement not working
Another method using the function isequal, which is useful for arrays: if ~isequal(UserResponse,RequiredCoordinat...

más de 10 años hace | 0

Respondida
Matrix Transfer of elements
Did you mean to assign the entire row? E.g., this? path(i,:)=SearchStart; Just guessing here since SearchStart is a 1x2 m...

más de 10 años hace | 0

Respondida
How to exit a for loop if the conditions within it are already met?
Sounds like you have two conditions, your relative error calculation and your guess being close enough. If you want to forgo the...

más de 10 años hace | 0

Respondida
How can I break from an inner loop but still continue the outer loop?
One way is to use an auxiliary variable. E.g., for t=1:1:473; breakinner = false; for Lfn=1.0005:0.0005:5; ...

más de 10 años hace | 4

Respondida
Hi I am getting the following error: Mex file entry point is missing. Please check the (case-sensitive) spelling of mexFunction (for C MEX-files), or the (case-insensitive) spelling of MEXFUNCTION (for FORTRAN MEX-files). What should I do? Thanks
You need to have this code in your Fortran file which will serve as the entry point for the mex function: #include "fintrf....

más de 10 años hace | 1

Respondida
How to store a vector under a for loop
theta(delta) = r1*sin(delta)*u; % <-- Added the (delta) indexing You will also need to change some of your matrix operators...

más de 10 años hace | 0

| aceptada

Respondida
I want to create a nxn matrix with all 0s and n randomly placed 1s
n = whatever; x = zeros(n); x(randperm(n*n,n)) = 1;

más de 10 años hace | 0

| aceptada

Respondida
cell of matrixes to cell of array
newC = cell(size(C)); for k=1:numel(C) M = C{k}'; newC{k} = M(:); end

más de 10 años hace | 0

Respondida
multiplying each non zero element of a sparse matrix by a certain number
W = S; G = logical(S); W(G) = W(G) .* P(:); Note: This preserves the sparse attribute of S. I.e., if S is sparse, th...

más de 10 años hace | 3

Respondida
Make this matrix multiplication more efficient
a = (B(1:n,:)*(A*b)).^2; You dimensions for B look a little strange to me, since your calculations do not use all of the ro...

más de 10 años hace | 0

| aceptada

Respondida
Compensating Accelerometer readings from gravity i.e., finding out the direction of movement
First, there are too many unknowns. E.g., what are the coordinate systems of the quaternions (ECI to BODY, or what)? Scalar firs...

más de 10 años hace | 0

Respondida
Matrix does not compile
Looks like you have unbalanced parentheses. E.g., this would fix that problem: if iris_data{1,1} < mean(iris_data{1,1}) ...

más de 10 años hace | 0

| aceptada

Respondida
Compare all elements in a matrix with elements in array
See if this helps do what you want: doc ismember

más de 10 años hace | 0

Respondida
Save figure in Matlab without borders
You might take a look at this FEX submission by Yair Altman: http://www.mathworks.com/matlabcentral/fileexchange/23629-export...

más de 10 años hace | 3

| aceptada

Respondida
Does the RAM cleaning by a software (e.g. Advanced SystemCare 8) during the code running affect the calculation?
I would strongly suspect that this only cleans RAM that is not currently in use by another process (e.g., MATLAB). Unless you se...

más de 10 años hace | 0

Cargar más