Question

Change the order of matrix

I want to change the order of B in accordance with Index. Index means that 'row 2' in B should change to 'row 5' in New_B. I w...

5 giorni ago | 1 answer | 0

Question

problem to write a condition for 'if'

I want to save A_new according to this condition: If A_new decreases the length of B, I want to save it. I wrote a code like ...

11 giorni ago | 1 answer | 0

Question

finding overlapping and non-overlapping values in matrix

I have A = [3 16 4 16 3 21 4 21 3 29 3 29 17 27 18 29 25 72 ...

13 giorni ago | 1 answer | 0

Question

How to reorder cell array based on the vector

I have index = [1; 2; 4; 3; 7; 6; 5]; list = {[1158;1159], [1543;1544], [2020;2096;2173], [2159], [4836], [5374], [5492;5493]...

13 giorni ago | 1 answer | 0

Question

using end in array

I have B=[]; A = {[1,2,3,15],[14,15,45,44,38,48,47,46]}; for i=1:length(A) for j=1: length(A{i})-1 temp = A{i}...

14 giorni ago | 1 answer | 0

Question

Find ones blocks in upper triangular matrix

I have A A=[0 0 0 0 0 0 0 0 0 0 0 0 0; 0 0 0 0 1 0 1 0 0 0 0 0 0; 0 0 0 0 0 1 0 0 0 0 0 0 0; 0 0 0 0 1 0 1 0 0 0 0 ...

18 giorni ago | 1 answer | 0

Question

remove rows in matrix if it is repeated 2 times

A = {[1,6,3,2],[3,6,5]}; A1 = unique([A{:}]); B = [1 2; 1 6; 2 3; 3 5; 3 6; 5 6]; B_bk = [1 2; 3 6; 3 5; 1 4; 4 6; 1 6; 6 5...

20 giorni ago | 1 answer | 0

Question

find missing element between two matrix

I have A=[1 2; 3 6; 3 5; 1 4; 4 6; 2 7; 1 6; 6 5; 2 3; 6 7; 3 4]; B=[1 2; 1 6; 2 3; 3 4; 4 6]; I want to find missing elemen...

20 giorni ago | 1 answer | 0

Question

save values in array

I have A={[1,6,3,2],[3,5,6]}; all_el =[]; for i=1:length(A) all_el(end)=A{i} end I want to have this result all_ell=...

21 giorni ago | 2 answers | 0

Question

produce all combinations of n choose k in binary

I have n=5; k=3; I want to have combinations of n choose k in binary result should be (5 choose 3=10) (the order does not m...

24 giorni ago | 3 answers | 0

Question

remove all ones from matrix in combinantion

I have A A=[0 0 0 0 0 0 0 0 0 0; 0 0 0 1 0 1 0 0 0 0; 0 0 0 1 1 0 0 0 0 0; 0 0 0 0 0 1 0 0 0 0; 0 0 0 0 0 0...

circa un mese ago | 1 answer | 0

Question

How to use unique function here

I have A={{[1,3,4],[1],[2,3,4,6,8]},{[1,2,34],[1,2,3,4,5,6,7],[1,2,9,6,4],[1,3,4]},{[8,9],[2,3,4,6,8],[1,3,4]}}; A = cellfun(...

circa un mese ago | 1 answer | 0

Question

Need to remove elements which repeated 2 times

I have A=[1 2; 1,3; 1,4; 1,5; 2,3; 3,6; 4,5; 5,6]; element 2, 4, 6 repeated 2 times. I want to remove them from A. A_new=[1...

circa un mese ago | 1 answer | 0

Question

How to keep column of removed row in matrix

I have matrix A and want to remove the rows of A that have nonzero element. Also want to keep the index of removed columns and r...

circa un mese ago | 1 answer | 0

Question

How can I draw non planar graph in 3D dimension

I have an edge data. G=graph(E(:,1),E(:,2)) h=plot(G) I want to draw it in 3D dimension. Is there any way to do that? I saw...

circa 2 mesi ago | 1 answer | 0

Question

Find the index of zero in cell and put it as empty

A={[45;101],[2;7],[5;8],0,0}; A(cell2mat(A)==0)={[]}; % I want to find zero and put in empty A should be A={[45;101],[2;7],[5...

3 mesi ago | 1 answer | 0

Question

how to write superscripts for x-axis in a boxplot

I have h=boxplot(x, g, 'notch','off','label', {'89_{p}','10007_{p}','3067_{M}'}); how to write p as a superscripts for x-axis...

3 mesi ago | 2 answers | 0

Question

how to change font size of bus number in graph

I have this graph M=[1,2;3,4;4,1;2,3] g = graph(M(:, 1), M(:, 2)); h = plot(g); I have attached the graph here and want to c...

3 mesi ago | 1 answer | 0

Question

remove and save row of matrix in while loop

I have remove_b=[] a=[0,1,1,1,1,0,1;0,0,1,1,0,1,1;0,0,0,1,1,0,1;0,0,0,0, 1,1,0;0,0,0,0,0,0,0]; b=[1,1;1,2;1,4;1,5;1,9]; [n1,...

4 mesi ago | 1 answer | 0

Question

Do not understand Curve intersections code

I used Curve intersections code and it gives the answer https://ww2.mathworks.cn/matlabcentral/fileexchange/22441-curve-interse...

6 mesi ago | 1 answer | 0

Question

change numbering inside cell

I have B=[1,1;2,2;3,40;4,10;5,15;6,19;7,22]; c={[1,10,15],[15,19,22],[1,2,40]}; Matrix B shows that 4 is correspond to10 or 7...

6 mesi ago | 1 answer | 0

Question

insert zero in chosen column of matrix randomly

I have A=[ 1 2 1 4 3 4 1 4 4 5 1 5 5 7 1 6 7 ...

7 mesi ago | 1 answer | 0

Question

remove row of matrix inside cell

I have A A={[1,2;4,5;8,9],[1,2,3;4,5,6;1,4,5;2,4,5],[3,4,5,6;1,2,3,4;8,9,0,8;3,4,5,6]} B={[1;3],[2;4],[2]} I want to remove B...

8 mesi ago | 1 answer | 0

Question

remove first element in cell and do not change index of other element

I have A, and want to remove first index from remain index A={[1,2,3],[2,6,8,7],[4,5,6,7,8,9,10]}; first_index=cellfun(@(v) fi...

8 mesi ago | 1 answer | 0

Question

change entry of sparse matrix

I have sparse matrix. I want to change entry [2;3;5] to [0.01;3.4;4.1] A=[1,0,0,0,0;0,2,0,0,0;0,0,4,0,0;0,0,0,3,0;0,0,0,0,6]; ...

8 mesi ago | 1 answer | 0

Question

change one column of matrix

I have A A=[1,0,4,0,5,0;0,1,0,3,-1,0;0,4,0,0,0,8]; B=[1.2,-1,-2.1,-1.3,-1.4,1;-2.1,1.3,-1,-2,-3,-1.8;1.9,-1.2,3.1,2.7,2.5,-0.5...

8 mesi ago | 2 answers | 0

Question

fix inv warning in matlab

I use this code: b=inv(A'*A)*A'*y; Matlab gives warning. never use inv to solve linear system How can I fix it?

8 mesi ago | 1 answer | 0

Question

add uniform random number to matrix

I want to add uniform number which change for each element of matrix. But if I use this code, same number add to element of A ...

9 mesi ago | 1 answer | 0

Question

generate Gaussian noise with certain mean and variance

I want to produse Gaussian noise. So, I use normrnd. m=0.17; n=normrnd(6.*m,m.*m); I think the n should be sometimes negative...

9 mesi ago | 0 answers | 0

Question

change the iteration in for loop

I have For Loop that calculate c. Sometimes c become nan or big number. When I get big amount or Nan for c, I want to repeat th...

9 mesi ago | 2 answers | 0