How to extract common & uncommon variables

조회 수: 3 (최근 30일)
Mekala balaji
Mekala balaji 2018년 1월 27일
댓글: Walter Roberson 2018년 2월 1일
Hi,
I have 5 test data of 10 (actually more than 150 variables) variables. Each test data of a particular variable is observed for one minute (50 data per minute), and I calculated the Standard deviation of 50 data point per each variable in each test. The STD is given below:
Test1 Test2 Test3 Test4 Test5
V1 0.00010 0.00200 0.01000 0.00300 0.00005
V2 0.00010 0.00000 0.01000 0.00300 0.00005
V3 0.00010 0.00200 0.02000 0.00100 0.00000
V4 0.00050 0.00100 0.03000 0.00100 0.00002
V5 0.00030 0.00200 0.01000 0.00200 0.00005
V6 0.00010 0.00300 0.00400 0.00310 0.00105
V7 0.00010 0.00100 0.01000 0.00310 0.00041
V8 0.00510 0.00500 0.00500 0.00140 0.00005
V9 0.00300 0.00200 0.03300 0.01300 0.03005
V10 0.00010 0.00200 0.01000 0.00300 0.00005
I want to extract the common variables in five tests whose STD >=0.001, and uncommon variables whose STD is <=0.001
Kindly someone help, and many thanks in advance,
  댓글 수: 1
Bernhard Suhm
Bernhard Suhm 2018년 2월 1일
Can you clarify what you mean by "common" versus "uncommon" variables?

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

답변 (1개)

Walter Roberson
Walter Roberson 2018년 2월 1일
Tests = [Test1,Test2,Test3,Test4,Test5];
common_vars = find(all(Tests>0.001, 2));
uncommon_vars = find(all(Tests<0.001, 2));
other_vars = setdiff(1:10, union(common_vars, uncommon_vars));
  댓글 수: 2
Mekala balaji
Mekala balaji 2018년 2월 1일
편집: Walter Roberson 2018년 2월 1일
clear all;
clc
[a,b,c]=xlsread('D:\Data/coomonInput.xlsx');
Tests=cell2mat(c(2:end,2:end));
common_vars = find(all(Tests>0.001, 2));
uncommon_vars = find(all(Tests<0.001, 2));
other_vars = setdiff(1:10, union(common_vars, uncommon_vars));
do I need to concatenate the column like FinalTests=[Tesst(:,1),Tesst(:,2),Tesst(:,3),Tesst(:,3),Tesst(:,4),Tesst(:,5)]
It gives me the following result:
>> common_vars
common_vars =
9
>> uncommon_vars
uncommon_vars =
0×1 empty double column vector
>> other_vars
other_vars =
1 2 3 4 5 6 7 8 10
But my desired output:
Name of variable(s) whose value is <=0.001 in all "tests"-->Commom
For example: If I set:
common_vars = find(all(Tests>0.005, 2));
it should give me:
[V6 V8]
-->because its values are <=0.006 in all tests)
Walter Roberson
Walter Roberson 2018년 2월 1일
No -- V6 starts with 0.00010 which is 1/10th of 0.001
V8 ends in 0.00005 which is 1/20th of 0.001
In my code if you change the > to >= then you will get V9 as common.

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

카테고리

Help CenterFile Exchange에서 Introduction to Installation and Licensing에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by