How do I classify a certain set of conditions in a dataset and print out the conditions in matlab?

1 visualización (últimos 30 días)
Hi all, so I have a given data file with 4 columns of numbers in it (see attached). I have a matlab code to handle the data given.
A = csvread('test1.txt');
B = A>1000;
C = A<1000;
Z1 = all(B(:,1:3),2);
Z2 = all(C(:,1:4),2);
Z3 = all(B(:,3:4),2);
Z4 = all(B(:,1),2);
Z5 = all(B(:,2),2);
Z6 = all(B(:,3),2);
Z7 = all(B(:,4),2);
X1 = all(B(:,1:3),2);
X2 = any(B(:,1:2),2);
C1 = {'','PowerGrip'};
C2 = {'','PrecisionGrip'};
C3 = {'','No Signal'};
C4 = {'','PrecisionGriplower'};
[num2str(A),char(strcat({' '},C1(1+Z1),C2(1+X2),C4(1+Z3),C3(1+Z2),C3(1+Z4),C3(1+Z5),C3(1+Z6),C4(1+Z7)))]
Is is actually possible to classify my data into a number of cases:
Case 1:
when
Column1 > 1000 or Column2 > 1000 or Column3 > 1000 or Column4 > 1000 or None of the columns > 1000
print an output of 'No Signal' beside the row of the given data
Case 2:
when
Columns 1,2,3 > 1000 or Columns 1,2&4 > 1000 or Columns 1,2,3,4 > 1000
print an output of 'Power Grip' beside the row of the given data
Case 3:
when
Columns 1,2 > 1000
print an output of 'Precision Grip' beside the row of the given data
Case 4:
when
Columns 3,4 > 1000 print an output of 'Precision Grip(Lower)' beside the row of the given data.
Right now with my current code(you can run it to see), I am receiving an output of conflicting possible configurations(see image below) and I understand its possibly due to my poorly set conditions above. What would be the best way to write the code such that there are no conflicts and I can receive one output of chracters per row in my command window?

Respuestas (0)

Categorías

Más información sobre Statistics and Machine Learning Toolbox en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by