Answered

64 bit binary number representation in matlab without rounding off

Assuming you have your binary in string of length 64 such as b=repmat('0',1,64); b([1 end])='1', You can convert to uint64 in...

64 bit binary number representation in matlab without rounding off

Assuming you have your binary in string of length 64 such as b=repmat('0',1,64); b([1 end])='1', You can convert to uint64 in...

environ 15 heures ago | 0

Answered

how to replace the elements row by rows instead of column by column in matrix

f = @(A)cumsum(A==3,2)>0; A = A + f(A).*fliplr(f(fliplr(A)))

how to replace the elements row by rows instead of column by column in matrix

f = @(A)cumsum(A==3,2)>0; A = A + f(A).*fliplr(f(fliplr(A)))

environ 19 heures ago | 1

Answered

Find first non-NaN in each column of array & combine into one vector

X = [2 NaN NaN NaN; 4 6 NaN NaN; NaN NaN NaN NaN; 5 4 7 8 ] [m,n] = size(X); [I,J] = ndgr...

Find first non-NaN in each column of array & combine into one vector

X = [2 NaN NaN NaN; 4 6 NaN NaN; NaN NaN NaN NaN; 5 4 7 8 ] [m,n] = size(X); [I,J] = ndgr...

1 jour ago | 1

| accepted

Answered

How to solve a special linear equation Ax=b? A is a row vector.

Code for p = Inf and noise_threshold = 0.01; A = [0.103+0.201i 0.196+0.294i 0.401+0.499i 0.602+6.993i 0.803+0.892i] b = 0.5+0....

How to solve a special linear equation Ax=b? A is a row vector.

Code for p = Inf and noise_threshold = 0.01; A = [0.103+0.201i 0.196+0.294i 0.401+0.499i 0.602+6.993i 0.803+0.892i] b = 0.5+0....

2 jours ago | 0

Answered

Finding unique set from large dataset

x = ["abc", "bcd", "ded"] % no need using curly bracket for strings string(unique(cat(2,x{:}))')'

Finding unique set from large dataset

x = ["abc", "bcd", "ded"] % no need using curly bracket for strings string(unique(cat(2,x{:}))')'

3 jours ago | 0

Answered

Full change of array?

You make a mixing array/scalar in your code. Change count(count+1) = count + 1; to count = count + 1;

Full change of array?

You make a mixing array/scalar in your code. Change count(count+1) = count + 1; to count = count + 1;

3 jours ago | 0

| accepted

Answered

Find equal rows between cell array and matrix into for loop

Try this: A=[-0.11 7.17 3.66 -0.09 3.45 1.55 -0.21 2.17 9.87 -0.14 4.88 6.66] B{1,1} = [-0.09 3.45 1.55] B{1,2...

Find equal rows between cell array and matrix into for loop

Try this: A=[-0.11 7.17 3.66 -0.09 3.45 1.55 -0.21 2.17 9.87 -0.14 4.88 6.66] B{1,1} = [-0.09 3.45 1.55] B{1,2...

3 jours ago | 0

| accepted

Answered

How to save a 3D surface plot in 2D view in vector image format?

Try this h=surfc(peaks,'LineStyle','none'); set(h(2),'LineColor','k'); view(2); % Make contour-plot on top of the surface ...

How to save a 3D surface plot in 2D view in vector image format?

Try this h=surfc(peaks,'LineStyle','none'); set(h(2),'LineColor','k'); view(2); % Make contour-plot on top of the surface ...

3 jours ago | 0

Answered

How to plot a struct with 2 fields in Matlab

Try this x=reshape([T(:).x],size(T)); y=reshape([T(:).y],size(T)); plot(x(:,[1:end 1])',y(:,[1:end 1])')

How to plot a struct with 2 fields in Matlab

Try this x=reshape([T(:).x],size(T)); y=reshape([T(:).y],size(T)); plot(x(:,[1:end 1])',y(:,[1:end 1])')

3 jours ago | 0

| accepted

Answered

Problem with data indexing in nested structure

n = length(Z.hours); % 3 sg=zeros(n,2); for i=1:n b = strcmp({Z.hours(i).AA(:).source},'sg'); sg(i,:) = [i,Z.hours(i...

Problem with data indexing in nested structure

n = length(Z.hours); % 3 sg=zeros(n,2); for i=1:n b = strcmp({Z.hours(i).AA(:).source},'sg'); sg(i,:) = [i,Z.hours(i...

4 jours ago | 0

Answered

How to unload C++ interface (of shared library)

Not sure if it's applicable for C++ but have you checked doc unloadlibrary

How to unload C++ interface (of shared library)

Not sure if it's applicable for C++ but have you checked doc unloadlibrary

4 jours ago | 0

Answered

Check points inside n number of triangle in a square

see pointLocation method of Triangulation class

Check points inside n number of triangle in a square

see pointLocation method of Triangulation class

4 jours ago | 0

Answered

Mix-integer optimization problem using GA

Take x1 fix allowed value, e.g. 32, optimize wrt (x2,...), repeat 4 times pick the solutions (among 4) with smallest score value...

Mix-integer optimization problem using GA

Take x1 fix allowed value, e.g. 32, optimize wrt (x2,...), repeat 4 times pick the solutions (among 4) with smallest score value...

4 jours ago | 0

Answered

I want to double all the points on the elliptic curves in matlab

See this post there a an algo to demonstrate doubling and adding points in EC. Adapt for your case % EL parameters a = 0; b ...

I want to double all the points on the elliptic curves in matlab

See this post there a an algo to demonstrate doubling and adding points in EC. Adapt for your case % EL parameters a = 0; b ...

4 jours ago | 0

| accepted

Answered

How can I get the index numbers of cells that form a specific string?

s='a.b.c.d.e' str=[{'a.b.c.d'};{'b.c.d.e'};{'a'};{'b'};{'c'};{'d'};{'e'}] c = idexing(str, s); c{:} str=[{'a.b'};{'b.c'}...

How can I get the index numbers of cells that form a specific string?

s='a.b.c.d.e' str=[{'a.b.c.d'};{'b.c.d.e'};{'a'};{'b'};{'c'};{'d'};{'e'}] c = idexing(str, s); c{:} str=[{'a.b'};{'b.c'}...

4 jours ago | 1

Answered

Assign Value to Multiply Indexed Range

You might store in a table, which by design put the two variables/row dimensions to the same level; so you can index them either...

Assign Value to Multiply Indexed Range

You might store in a table, which by design put the two variables/row dimensions to the same level; so you can index them either...

4 jours ago | 0

| accepted

Answered

How to get the vertex points of all grid points within a cube?

[x,y,z]=ndgrid(0:5); scatter3(x(:),y(:),z(:),'r')

How to get the vertex points of all grid points within a cube?

[x,y,z]=ndgrid(0:5); scatter3(x(:),y(:),z(:),'r')

4 jours ago | 1

Answered

Finding the Probability of a Sequence of Numbers

N = histcounts2(A(1:end-1),A(2:end),1:121,1:121); p = N / sum(N(:))

Finding the Probability of a Sequence of Numbers

N = histcounts2(A(1:end-1),A(2:end),1:121,1:121); p = N / sum(N(:))

4 jours ago | 0

Answered

How to speedup assignment of indexed large matrix?

In general on a computer there is a huge different between accessing contiguous memory block (fast, the later code) and non cont...

How to speedup assignment of indexed large matrix?

In general on a computer there is a huge different between accessing contiguous memory block (fast, the later code) and non cont...

5 jours ago | 0

| accepted

Answered

How can I create a matrix with combination of some other matrix elemenst dynamicaly in a loop

V = {[1 2 3] [4 5] [6 7 8] [9 10]}; M = zeros(1,0); n = cell(0); for k=1:length(V) Vk = V{k}; % replace by your dynami...

How can I create a matrix with combination of some other matrix elemenst dynamicaly in a loop

V = {[1 2 3] [4 5] [6 7 8] [9 10]}; M = zeros(1,0); n = cell(0); for k=1:length(V) Vk = V{k}; % replace by your dynami...

5 jours ago | 0

| accepted

Answered

How to extract only numerical values from cell into new column array?

s={"chb12_06.edf" "1665 seconds" "1726 seconds" "3415 seconds" "3447 seconds" "chb12_08.edf" "1426 seconds" "1439 seconds" "1591...

How to extract only numerical values from cell into new column array?

s={"chb12_06.edf" "1665 seconds" "1726 seconds" "3415 seconds" "3447 seconds" "chb12_08.edf" "1426 seconds" "1439 seconds" "1591...

5 jours ago | 0

| accepted

Answered

How do I find the centre of gravity for an irregular shape?

You can get the coordinates of the centroid if you have a boundary coordinates of a polygonal region: [xc,yc] = polygoncentroid...

How do I find the centre of gravity for an irregular shape?

You can get the coordinates of the centroid if you have a boundary coordinates of a polygonal region: [xc,yc] = polygoncentroid...

6 jours ago | 0

| accepted

Answered

Replace elements of a matrix by a smaller matrix which contains circular shaped values margins

C = A; sB = size(B); idx = {1+(1:sB(1)),1+(1:sB(2))}; % adjust offset 1 and 1 if B to be moved at other place C(idx{:}) = B ...

Replace elements of a matrix by a smaller matrix which contains circular shaped values margins

C = A; sB = size(B); idx = {1+(1:sB(1)),1+(1:sB(2))}; % adjust offset 1 and 1 if B to be moved at other place C(idx{:}) = B ...

6 jours ago | 0

| accepted

Answered

How to compute a Hankel matrix for N-dimension ?

Not sure what is the Hankel in 4-D but by extension in 2D it should be something like this w=5; x=4; y=3; z=2; b = rand(1,w...

How to compute a Hankel matrix for N-dimension ?

Not sure what is the Hankel in 4-D but by extension in 2D it should be something like this w=5; x=4; y=3; z=2; b = rand(1,w...

6 jours ago | 0

| accepted

Answered

How to fit ellipse equation through segment of ellipse?

Warning: you won't ever get reilable ellipse with such as small portion of data. I'll still provide you a code (Optimization ...

How to fit ellipse equation through segment of ellipse?

Warning: you won't ever get reilable ellipse with such as small portion of data. I'll still provide you a code (Optimization ...

6 jours ago | 1

Answered

How to gracefully truncate a matrix of unknown dimensions?

Input = rand(3,4,5) Dimension = 2; a=2; b=4; commaidx = cell(size(size(Input))); commaidx(:) = {':'}; commaidx{Dimension}...

How to gracefully truncate a matrix of unknown dimensions?

Input = rand(3,4,5) Dimension = 2; a=2; b=4; commaidx = cell(size(size(Input))); commaidx(:) = {':'}; commaidx{Dimension}...

8 jours ago | 0

Answered

Find constraints on polynomial coefficients optimization

Why can't you implement ts := max(min(-a2/(2*a1),T),0); Then add the 6 constraints into your minimization pb: two non-linear ...

Find constraints on polynomial coefficients optimization

Why can't you implement ts := max(min(-a2/(2*a1),T),0); Then add the 6 constraints into your minimization pb: two non-linear ...

9 jours ago | 0

| accepted

Answered

Vector decomposition with Matlab

b= [2; 1; 2; 1; 0; 1; 2; 1; 2] b1=min(b,1); b1([find(b==2,1,'first'),find(b==2,1,'last')])=2; b2=b-b1; n=length(b); tail=...

Vector decomposition with Matlab

b= [2; 1; 2; 1; 0; 1; 2; 1; 2] b1=min(b,1); b1([find(b==2,1,'first'),find(b==2,1,'last')])=2; b2=b-b1; n=length(b); tail=...

9 jours ago | 1

| accepted

Answered

For a multidimensional array is it possible to return all other array dimensions for a single index of one dimension without having to use the colon for indexing?

Mdls = struct(); % Initialise Mdls as struct Mdls = repmat(Mdls,[2,4,6,8,6,4,2]); % Arbitrarily size the struct dim = 3; % dim...

For a multidimensional array is it possible to return all other array dimensions for a single index of one dimension without having to use the colon for indexing?

Mdls = struct(); % Initialise Mdls as struct Mdls = repmat(Mdls,[2,4,6,8,6,4,2]); % Arbitrarily size the struct dim = 3; % dim...

10 jours ago | 0

| accepted

Answered

How to find the nearest positive definite matix

Find the smallest eigen value lbdmin of A (use for example EIGS function), then change A by adding A + max(-lbdmin,0)*eye(size...

How to find the nearest positive definite matix

Find the smallest eigen value lbdmin of A (use for example EIGS function), then change A by adding A + max(-lbdmin,0)*eye(size...

11 jours ago | 1