plotting lines from data in a 2D matrix

조회 수: 5 (최근 30일)
Farai Mahachi
Farai Mahachi 2020년 1월 3일
편집: KALYAN ACHARJYA 2020년 1월 3일
I have a 2D matrix with values as shown in the diagram below. How can I plot two or more lines connecting points of colums with only numbers greater than a threshold?
draw_lines.png
Regards,,,

답변 (1개)

KALYAN ACHARJYA
KALYAN ACHARJYA 2020년 1월 3일
편집: KALYAN ACHARJYA 2020년 1월 3일
mat_data=randi(10,[7,6]); % Or any matrix data, any sizes
[r c]=size(mat_data);
iter=1;
plot_data=cell(1,2);
data1=[];
while iter<=2
fprintf('Enter the row Position for %d initial (equal or lesss than %d):',iter,c);
data_value=input('');
data1=mat_data(data_value,1);
for j=2:c
col_data=max(mat_data(data_value-1:data_value+1,j));
data1(j)=col_data;
end
plot_data{iter}=data1;
iter=iter+1;
end
plot(plot_data{1},plot_data{2});

카테고리

Help CenterFile Exchange에서 Mathematics에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by