Answered
dcm2quat is returning invalid quaternions
ACB is not a valid direction cosine matrix. You can see that its determinant is not close to 1: >> ACB = [ 0.4970 0.8...

8 years ago | 0

| accepted

Answered
How can I run my first Mex function?
Some problems: 1) /* coppy array and set the output pointer to it */ plhs[0] = prhs[2]; The above line doe...

8 years ago | 3

| accepted

Answered
Am beginner here, can anyone tell me What is wrong with the code with while loop?
You never update the "a" vector inside the loop. It was built from the original values of x and y and never changes. To fix thi...

8 years ago | 0

| accepted

Answered
3D array permutation
According to the doc for contour(Z), _"... The x values correspond to the column indices of Z and the y values correspond to the...

8 years ago | 0

Answered
Index exceeds matrix dimensions error
You can get this error if numel(w)<6, so I would check that first.

8 years ago | 0

Answered
Help with "mxGetPi is deprecated"
With the R2018a release of MATLAB, complex real/imag data is stored in an interleaved fashion instead of the separate fashion of...

8 years ago | 1

| accepted

Answered
How does MATLAB internally store sparse arrays / Calling MKL's sparse BLAS library for sparse matrix operations
MATLAB stores sparse matrices in the CSC 0-based format, except MATLAB does not store the pointerB and pointerE info the same wa...

8 years ago | 1

| accepted

Answered
Row subtraction in matrix
Just negate the usual diff() result. E.g., x = your matrix result = -diff(x);

8 years ago | 0

Answered
Is there a way to get references to property attributes of handle class objects within the new R2018a C++ mex library?
I'm not exactly sure what you are really trying to do in your mex routine (read-only or write also?), but maybe this submission ...

8 years ago | 0

Answered
What to use instead of horzcat for N-D Arrays?
AA(end,end,200) = 0;

8 years ago | 0

| accepted

Answered
how can i find values of R
Multiply by R to get a polynomial in R, then use the roots() function.

8 years ago | 1

Answered
reading a binary file into matlab
This line fid = fopen('fname'); trys to open a file that is named exactly 'fname', which is not what you want. You proba...

8 years ago | 0

| accepted

Answered
How to count digits of a number in easy way?
See these related posts: <https://www.mathworks.com/matlabcentral/answers/142819-how-to-find-number-of-significant-figures-in...

8 years ago | 0

Answered
How to get the submatrix from a function's returned matrix in one line?
MATLAB does not allow direct indexing into function results. This must be done in two steps. x = rref(A); x = x(:,4);

8 years ago | 1

| accepted

Answered
How to use <=, >= logic operators for imaginary part of a complex number?
You can do this explicitly by picking off the imag parts. E.g., imag(x) >= imag(y)

8 years ago | 0

| accepted

Submitted


ISSHARED determines data sharing status among workspace variables
ISSHARED determines data sharing status among workspace variables

8 years ago | 1 download |

5.0 / 5

Answered
How to find the scalar multiple of two vectors?
E.g., (with some accounting for potential 0 values) d = b ./ a; result = mean(d(~isnan(d))); This is naive code that ...

8 years ago | 0

Answered
How can I choose one element form a row array randomly?
result = T(randi(numel(T)));

8 years ago | 2

| accepted

Answered
How to swap elements of the first column of the S matrix with the first line elements?
If only the 1st column and row are involved, e.g. a simple swap: A1 = A(:,1); A(:,1) = A(1,:); A(1,:) = A1;

8 years ago | 0

| accepted

Answered
Matrix multiplication of 3d arrays
Some options from the FEX: MULTIPROD: <https://www.mathworks.com/matlabcentral/fileexchange/8773-multiple-matrix-multiplic...

8 years ago | 0

Answered
Creating composed function in MATLAB
E.g., vectorized code using logical indexing: y = zeros(size(x)); g = x <= 0; y(g) = cos(x(g)); y(~g) = sin(x(~g))...

8 years ago | 0

Answered
How to reshape/permute array correctly?
E.g., x = your array y = permute(x,[1 4 2 3 5]); % Or permute(x,[4 1 2 3 5]) depending on order that you want result ...

8 years ago | 0

| accepted

Answered
How can i use a struct/cell in a Function?
The variable name you are using as the input argument in your function is "Input", not "data". There is no "data" variable in yo...

8 years ago | 0

| accepted

Answered
Matlab eventually crashes on Mex function
Are you sure that message is null terminated, and that sType is large enough? What happens if you do this: char sType[33]; ...

8 years ago | 0

Answered
mex -output option not recognized
Try splitting up the output argument, e.g., mex('-output','my_program',...etc

8 years ago | 0

| accepted

Answered
How can I solve the given differential equation numerically and symbolically ?
To get the derivatives y' and y'' yp = diff(y); ypp = diff(yp); To turn them all into function handles for plotting ...

8 years ago | 0

Answered
Given x, how to create y = [1:x(1),1:x(2),...,1:x(end)] efficiently?
One way: n = arrayfun(@(n)1:n,x,'Uni',false); y = [n{:}];

8 years ago | 0

Answered
compare all elements in a column with elements of another column
E.g., c = the column number in question M = your matrix Mc = M; Mc(:,c) = []; % M with column c removed if( all...

8 years ago | 0

Answered
Writing a Taylor series function in matlab
You're close, but you need to pass in a function handle and then fix up a few other things in your code. So call the code like t...

8 years ago | 0

Answered
str2double/str2num
Floating point variables do not have leading 0's physically stored in memory (not counting the denormalized numbers of course). ...

8 years ago | 1

| accepted

Load more