필터 지우기
필터 지우기

transform column of inequality data??

조회 수: 1 (최근 30일)
Daniel Hines
Daniel Hines 2020년 2월 27일
답변: Prabhan Purwar 2020년 3월 5일
Hello, I have a column of inequality data (see attached) that I am trying to transform into 3 new columns but I don't know the right syntax/formula. The first column containing the number values for all of the less than inequality data, the second column containing all of the data points that were reported as a number, and the third column containing all of the number values for the data points that were reported as greater than. I was thinking it would be some combination of using logicals and filter operators but I have been unsuccessful. What is the appropriate code to do this? Thank you for any help you can give me
Example:
Dan
  댓글 수: 1
darova
darova 2020년 2월 27일
Can you show yuor attempts? What about something like that
out3 = data > 32;

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

답변 (1개)

Prabhan Purwar
Prabhan Purwar 2020년 3월 5일
Hi,
Kindly try using the following code:
clc
close all
clear
var=readcell('data_example (3)'); %Load data
tbl{1,1}=var{1,2};
tbl{1,2}=var{1,3};
tbl{1,3}=var{1,4};
for i=2:13
a=var{i,1};
tfg=strcmp(a(1),'>'); %String compare
tfs=strcmp(a(1),'<');
if(tfg==1) tbl{i,3}=a(2:end);
end
if(tfs==1) tbl{i,1}=a(2:end);
end
if (tfs==0 && tfg==0 ) tbl{i,2}=a(1:end);
end
tfs=0;tfg=0;
end
Output:

카테고리

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

태그

아직 태그를 입력하지 않았습니다.

제품

Community Treasure Hunt

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

Start Hunting!

Translated by