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

Answered
Computing a weighted sum of matrices
On later versions of MATLAB: result = sum(M.*reshape(x,1,1,[]),3); On earlier versions of MATLAB you need to use bsxfun:...

8 years ago | 1

| accepted

Answered
how to fix 'Error using * Inner matrix dimensions must agree.' help please
Your 'angle' and 'speed' variables are strings you use for the input prompts. They are not the user inputs, which are x and y. S...

8 years ago | 0

Answered
How can I tag each variable name in a .mat file with a trial number?
Please, please, please don't do this! It will be very hard to use those variables downstream in your code without a lot of nasty...

8 years ago | 1

Answered
Matlab incorrectly reading a binary file
Please show the Fortran code that was used to write the file, and also the Fortran code that correctly reads the file. Depending...

8 years ago | 0

Answered
I'm not sure how to set the stop criterion in the bisecting method
Inside the loop you can use this: if( abs(a-b) <= epsilon ) break; end Where epsilon is a value you set prior ...

8 years ago | 0

| accepted

Load more