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

alrededor de 8 años hace | 3

| aceptada

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

alrededor de 8 años hace | 0

| aceptada

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

alrededor de 8 años hace | 0

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

alrededor de 8 años hace | 0

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

alrededor de 8 años hace | 1

| aceptada

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

alrededor de 8 años hace | 1

| aceptada

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

alrededor de 8 años hace | 0

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

alrededor de 8 años hace | 0

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

alrededor de 8 años hace | 0

| aceptada

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

alrededor de 8 años hace | 1

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

alrededor de 8 años hace | 0

| aceptada

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

alrededor de 8 años hace | 0

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

alrededor de 8 años hace | 1

| aceptada

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

alrededor de 8 años hace | 0

| aceptada

Enviada


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

alrededor de 8 años hace | 1 descarga |

5.0 / 5

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

alrededor de 8 años hace | 0

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

alrededor de 8 años hace | 2

| aceptada

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

alrededor de 8 años hace | 0

| aceptada

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

alrededor de 8 años hace | 0

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

alrededor de 8 años hace | 0

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

alrededor de 8 años hace | 0

| aceptada

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

alrededor de 8 años hace | 0

| aceptada

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

alrededor de 8 años hace | 0

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

alrededor de 8 años hace | 0

| aceptada

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

alrededor de 8 años hace | 0

Respondida
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{:}];

alrededor de 8 años hace | 0

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

alrededor de 8 años hace | 0

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

alrededor de 8 años hace | 0

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

alrededor de 8 años hace | 1

| aceptada

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

alrededor de 8 años hace | 1

| aceptada

Cargar más