필터 지우기
필터 지우기

How to plot Data based fifth column

조회 수: 3 (최근 30일)
Med Future
Med Future 2022년 12월 14일
답변: Dyuman Joshi 2022년 12월 14일
Hello, i hope you are doing well. I have the dataset which have five column , I want to plot first two column values based on fifth column value, which basically Number of classses 0 or 1
  댓글 수: 2
Dyuman Joshi
Dyuman Joshi 2022년 12월 14일
Something like this?
y=load('Data.mat').pdw;
y0=y(:,5)==0;
y1=y(:,5)==1;
plot(y(y0,1),y(y0,2))
hold on
plot(y(y1,1),y(y1,2))
legend({'Corresponding to Zero', 'Corresponding to One'})
There are some repetetive values in the data, as seen by the graph.
Med Future
Med Future 2022년 12월 14일
@Dyuman Joshi i also want to print the How many values of 0 and 1 in the dataset?

댓글을 달려면 로그인하십시오.

채택된 답변

Dyuman Joshi
Dyuman Joshi 2022년 12월 14일
y=load('Data.mat').pdw;
y0=y(:,5)==0;
y1=y(:,5)==1;
plot(y(y0,1),y(y0,2))
hold on
plot(y(y1,1),y(y1,2))
legend({'Corresponding to Zero', 'Corresponding to One'})
%numbers of 0
n0=nnz(y0)
n0 = 9479
%numbers of 1
n1=nnz(y1)
n1 = 434
Use fprintf or sprintf if you actually want to print the values

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Data Type Identification에 대해 자세히 알아보기

제품


릴리스

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by