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

1 day 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...

11 days 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...

2 months 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...

2 months 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...

2 months 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,...

3 months 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...

5 months 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...

5 months 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 ...

5 months 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...

6 months 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...

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

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

7 months 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?

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

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

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

7 months ago | 2 answers | 0

Question

find Nan in cell

I want to find nan element in A, A={[],[],[31],[2,1]}; %first case A1={[],[2],[3],[6]}% second case I used this code, but di...

8 months ago | 1 answer | 0

Question

extract the most repeated element of a cell array

A={[],[18],[14],[],[],[],[14],[],[14],[18]}; I want to get most repeated element in A, (except nan). result should be B=14 f...

8 months ago | 1 answer | 0

Question

use Tic Toc for function

I want to calculate simulation time of only bigest length of A. A={[1,2],[1,2,4,5,6,7],[4,8,2],[1,3,5,7]} [~,index] = max(cell...

8 months ago | 1 answer | 0

Question

omit nonzero elemnt in cell

A={[3,4],[8,9],[1,2],0,0,0}; A(cell2mat(A)==0)={[]}; I used this code, but have error Error using cat Dimensions of arrays b...

8 months ago | 2 answers | 0

Question

find zero and nonzero elemnt in cell

A={[21],[0],[32],[4],[60],[0],[0]}; B=A; temp=cell2mat(A); temp_1=find(temp==0); B=cellfun(@(m,y) y(m)==0.1,temp_1,A, 'Unifo...

9 months ago | 1 answer | 0

Question

put number in cell

A={[21],[],[32],[4],[60],[]}; length_A = cellfun(@(m) length(m),A,'uni',0); B= cell(1, size(A,2)); B(cell2mat(length_A)) = 0....

9 months ago | 2 answers | 0

Question

solving memory problem for this code

I run this code for X that has size 42*12 if size(X,2)==1 M=0; end n = size(X, 1); rank_X = rank(X); ...

9 months ago | 1 answer | 0

Question

find largest magnitude in array

A=[-0.1;1;-5;-0.8;-0.4]; tto=find(A == max(abs(A))) tt=find(A ~= max(abs(A))) I want to find index of largest magnitude in ar...

10 months ago | 1 answer | 0

Question

odd and even index in cell

A={[113],[112],[42],[29],[113],[69],[86],[9],[0]}; B={[18],[14],[5],[39],[27],[11],[9],[7],[0]}; I want put even index in A to...

10 months ago | 1 answer | 0

Question

length of arrey in cell and remove 0

A={[113],[112],[42],[29],[113],[69],[86],[0],[0]}; B={[18],[14],[5],[39],[27],[11],[9],[0],[0]}; C=cellfun(@(m,u) length(m)+le...

10 months ago | 1 answer | 0

Question

how many times specific number repeated in cell

E=[1 2;1 5;2 3;2 4;2 5;3 4;4 5;4 7;4 9;5 6;6 11;6 12;6 13;7 8;7 9;9 10;9 14;10 11;12 13;13 14]; N=(1:max(E(...

10 months ago | 1 answer | 0

Question

select specific row in a matrix

A=[1;2;237;250;800;805]; B=[1,1,0.5;2,1,2;3,1,1;4,1,3;16,1,1;237,4,5;240,2,3;250,2,4;280,6,7;800,4,5;805,7,8]; I want to selec...

10 months ago | 1 answer | 0

Question

omit zeros from matrix and have the shape of matrix

A=[0,0;0,0;0,0;1,2;2,5;5,7;7,8]; I want to omit zero from this matrix. result should be New_A=[1,2;2,5;5,7;7,8]; I use this c...

11 months ago | 1 answer | 0