Answered

How can I call M fuctions in different thread in mex coding matlab and C++?

No you cannot. MATLAB will crash since many MATLAB functions are not thread safe.

How can I call M fuctions in different thread in mex coding matlab and C++?

No you cannot. MATLAB will crash since many MATLAB functions are not thread safe.

3 Monate ago | 0

| accepted

Answered

How to quickly do Cholesky factorization for many small matrices?

It requires MEX, but it should be fast https://www.mathworks.com/matlabcentral/fileexchange/37515-mmx

How to quickly do Cholesky factorization for many small matrices?

It requires MEX, but it should be fast https://www.mathworks.com/matlabcentral/fileexchange/37515-mmx

3 Monate ago | 0

Answered

how to vectorize squared function

X=rand(3,10); Y=rand(4,10); L=rand(10); N=size(X,1); M=size(Y,1); XX=reshape(X,N,1,[]); YY=reshape(Y,1,M,[]); YX=reshap...

how to vectorize squared function

X=rand(3,10); Y=rand(4,10); L=rand(10); N=size(X,1); M=size(Y,1); XX=reshape(X,N,1,[]); YY=reshape(Y,1,M,[]); YX=reshap...

3 Monate ago | 0

Question

Trigger event for graphic handle object?

The function notify seems to be designed for user-define class. Is it possible to make it works on MATLAB graphic handle objects...

3 Monate ago | 0 answers | 2

Answered

Is it possible to make inactive some of lines?

Put "..." (without the quotes) in front of the lines you want to hide

Is it possible to make inactive some of lines?

Put "..." (without the quotes) in front of the lines you want to hide

4 Monate ago | 0

Answered

Return all ShortestPath explored nodes

This problem has been answered in this thread https://www.mathworks.com/matlabcentral/answers/494497-how-can-i-get-all-the-exi...

Return all ShortestPath explored nodes

This problem has been answered in this thread https://www.mathworks.com/matlabcentral/answers/494497-how-can-i-get-all-the-exi...

4 Monate ago | 0

Answered

How interp2 deal with edges on bicubic interpolation?

The boundary handling is descriibed in the section Boundary Condition of this Cubic interpolation reference Especially the equa...

How interp2 deal with edges on bicubic interpolation?

The boundary handling is descriibed in the section Boundary Condition of this Cubic interpolation reference Especially the equa...

4 Monate ago | 2

| accepted

Answered

splines with derivative conditions at support points

There is the option point-wise constraints (pntcond) of my FEX BSFK to achieve your goal.

splines with derivative conditions at support points

There is the option point-wise constraints (pntcond) of my FEX BSFK to achieve your goal.

4 Monate ago | 0

Answered

how to use threads in matlab app designer

Many MATLAB stock functions are not thread safe, they are not suitable for multi-thread run. This is MATLAB limitation one canno...

how to use threads in matlab app designer

Many MATLAB stock functions are not thread safe, they are not suitable for multi-thread run. This is MATLAB limitation one canno...

4 Monate ago | 0

Answered

Compiler Support for IntelĀ® oneAPI Toolkits - Fortran

It works for me (C) you light be abe to adapt for fortran https://www.mathworks.com/matlabcentral/answers/678588-mex-how-to-mod...

Compiler Support for IntelĀ® oneAPI Toolkits - Fortran

It works for me (C) you light be abe to adapt for fortran https://www.mathworks.com/matlabcentral/answers/678588-mex-how-to-mod...

4 Monate ago | 0

Answered

How to generate random uint64 values

maxval = int64(2^60); n = 100; twop32 = 2^32; q = double(maxval/twop32); hi = floor(q*rand(1,n)); himax = floor(q); lom...

How to generate random uint64 values

maxval = int64(2^60); n = 100; twop32 = 2^32; q = double(maxval/twop32); hi = floor(q*rand(1,n)); himax = floor(q); lom...

4 Monate ago | 0

Answered

How to generate random uint64 values

I can't see why you are reluctant to generate 2 x 4 bytes r = typecast(randi(intmax('uint32'),2*100,1,'uint32'),'uint64')

How to generate random uint64 values

I can't see why you are reluctant to generate 2 x 4 bytes r = typecast(randi(intmax('uint32'),2*100,1,'uint32'),'uint64')

4 Monate ago | 1

Answered

Graph Laplacian and adjacency matrix

Not sure what data format you have, but for graph % TMW example s = [1 2 2 3 3 3 4 5 5 5 8 8 9]; t = [2 3 4 1 4 5 5 3 6 7 9 1...

Graph Laplacian and adjacency matrix

Not sure what data format you have, but for graph % TMW example s = [1 2 2 3 3 3 4 5 5 5 8 8 9]; t = [2 3 4 1 4 5 5 3 6 7 9 1...

4 Monate ago | 0

Answered

Best practices to use Matlab assert

No C debug mode slows every statement down. ASSERT costs the overhead of checking whatever you instruct MATLAB to check. It ma...

Best practices to use Matlab assert

No C debug mode slows every statement down. ASSERT costs the overhead of checking whatever you instruct MATLAB to check. It ma...

5 Monate ago | 0

Answered

Program to generate permutations in a certain order

clear X X{1}=[1 1 0 1]; X{2}=[1 0 1 0]; X{3}=[1 0 1 1]; X{4}=[1 1 1 0]; X{5}=[0 1 0 1]; X{6}=[0 0 0 1]; n=length(X); P...

Program to generate permutations in a certain order

clear X X{1}=[1 1 0 1]; X{2}=[1 0 1 0]; X{3}=[1 0 1 1]; X{4}=[1 1 1 0]; X{5}=[0 1 0 1]; X{6}=[0 0 0 1]; n=length(X); P...

5 Monate ago | 1

Answered

Equivalent of c++'s NULL or python' s None in MATLAB

If you use recent MATLAB you can use also missing and ismissing

Equivalent of c++'s NULL or python' s None in MATLAB

If you use recent MATLAB you can use also missing and ismissing

5 Monate ago | 0

Question

How to change number precision with writestruct

The number of significant digits of writestruct is quite limited, as showed by this example s=struct('pi',pi); writestruct(s,...

5 Monate ago | 1 answer | 0

Answered

Replace nested loops with a matrix

i=2:nhx-1; j=2:nhy-1; U(i,j)= U(i,j)-dt*(Pc(i+1,j)-Pc(i-1,j))/(2*hx);

Replace nested loops with a matrix

i=2:nhx-1; j=2:nhy-1; U(i,j)= U(i,j)-dt*(Pc(i+1,j)-Pc(i-1,j))/(2*hx);

6 Monate ago | 1

| accepted

Answered

Get indices of all rows containing a value - repeated or not

[c,~,J] = unique(sort(connections,2),'rows'); [i,~,I] = unique(c); [~,j] = ismember(i, id); xy = [x(j) y(j)]; I = reshape(I,...

Get indices of all rows containing a value - repeated or not

[c,~,J] = unique(sort(connections,2),'rows'); [i,~,I] = unique(c); [~,j] = ismember(i, id); xy = [x(j) y(j)]; I = reshape(I,...

6 Monate ago | 0

| accepted

Answered

Is there a way to vectorise this vector/matrix product?

G = real(dot(W,R*W,1)).';

Is there a way to vectorise this vector/matrix product?

G = real(dot(W,R*W,1)).';

6 Monate ago | 0

Answered

Relative Ranking of position in an array

I10=[1 2 1 1 1 2 1 1 2 2 1 3 6 3 1 3 3 1 4 3 4 3 2 3 4 2 3 3 4 2 7 4 6 2 5 4 5 5 5 5 6 7 5 4 5 8 8 6 4 5 4 6 6 7 9 7 7 2 7...

Relative Ranking of position in an array

I10=[1 2 1 1 1 2 1 1 2 2 1 3 6 3 1 3 3 1 4 3 4 3 2 3 4 2 3 3 4 2 7 4 6 2 5 4 5 5 5 5 6 7 5 4 5 8 8 6 4 5 4 6 6 7 9 7 7 2 7...

6 Monate ago | 0

Answered

Optimize repeated permutation of a large vector

s = [1 2 3 4 5 6 7 8]; n=[4 3 1]; c=cumsum([0 n]); p=2:length(s)+1; p(c(2:end))=c(1:end-1)+1; s(p)

Optimize repeated permutation of a large vector

s = [1 2 3 4 5 6 7 8]; n=[4 3 1]; c=cumsum([0 n]); p=2:length(s)+1; p(c(2:end))=c(1:end-1)+1; s(p)

6 Monate ago | 0

Answered

Error using fwrite : Cannot write value: sparse arrays are unsupported.

[i,j,v] = find(S); then save i,j,v with fwrite

Error using fwrite : Cannot write value: sparse arrays are unsupported.

[i,j,v] = find(S); then save i,j,v with fwrite

6 Monate ago | 0

| accepted

Answered

Optimize repeated permutation of a large vector

s = [1 2 3 4 5 6 7 8]; i=1:length(s); n=[4 3 1]; c=cumsum([1 n]); b=cumsum(ismember(i,c)); p=mod(i+1-c(b),n(b))+c(b) s(p...

Optimize repeated permutation of a large vector

s = [1 2 3 4 5 6 7 8]; i=1:length(s); n=[4 3 1]; c=cumsum([1 n]); b=cumsum(ismember(i,c)); p=mod(i+1-c(b),n(b))+c(b) s(p...

6 Monate ago | 0

| accepted

Answered

find the position of all non-zero minimum values in each column of a matrix

a = [2 0 3;1 2 5;0 0 0;1 3 3;0 0 6;0 2 7;1 0 0] b=a; b(b==0)=NaN; [r,c]=find(b==min(b,[],1)); rmin=accumarray(c(:),r(:),[siz...

find the position of all non-zero minimum values in each column of a matrix

a = [2 0 3;1 2 5;0 0 0;1 3 3;0 0 6;0 2 7;1 0 0] b=a; b(b==0)=NaN; [r,c]=find(b==min(b,[],1)); rmin=accumarray(c(:),r(:),[siz...

6 Monate ago | 1

Answered

Turn logical matrix into string vector

Assuming idx has one 1 per row idx = logical([0 1 0; 0 0 1; 1 0 0; 1 0 0; 0 1 0]); vec = ["A","B","C"]; [r,c]=find(idx); r...

Turn logical matrix into string vector

Assuming idx has one 1 per row idx = logical([0 1 0; 0 0 1; 1 0 0; 1 0 0; 0 1 0]); vec = ["A","B","C"]; [r,c]=find(idx); r...

6 Monate ago | 1

Answered

Symetric matrix power optimization

Youeu can edit MATLAB function mpower.m and try to the basic calculation (line 76 in my case) D = D*D; % I assume p is integer...

Symetric matrix power optimization

Youeu can edit MATLAB function mpower.m and try to the basic calculation (line 76 in my case) D = D*D; % I assume p is integer...

6 Monate ago | 0

| accepted

Answered

How can I avoid loop for code optimization?

Use MultipleQR FEX (C compiler for MEX build is required, unless for Windows platform) y = linspace(1,10,1000); Y = reshape(...

How can I avoid loop for code optimization?

Use MultipleQR FEX (C compiler for MEX build is required, unless for Windows platform) y = linspace(1,10,1000); Y = reshape(...

6 Monate ago | 1