To calculate value in a uitable
Afficher commentaires plus anciens
In a uitable table, I have produce a matrix as below:
>> a= [1 1 1 2 2 3 3 3 4 ; 3 3 1 4 4 4 3 1 1; 3 3 2 4 1 1 1 3 2]
a =
1 1 1 2 2 3 3 3 4
3 3 1 4 4 4 3 1 1
3 3 2 4 1 1 1 3 2
Therefore,in each row, I need to calculate the marks occur based on conditions below:
1. if no 3 occur in three cells continuously therefore the mark charged is 30.
2. if no 3 occur in two cells continuously and then followed by no 1 in the next cell, the mark charged is -20.
3. if no 3 occur in a cell and then followed by no 1 in the next cell, the mark charged is -10.
4. if no 3 occur in two cells continuously and then followed by no 2 in the next cell, the mark charged is -20.
5. if no 3 occur in a cell and then followed by no 2 in the next cell, the mark charged is 0.
Then, in each row, the total marks will calculate. Finally the result will be save in a matrix like this:
marks =
-30
-30
-20
This marks also will total to become an X value as below:
X = -80
How can I code this problem in matlab? Please help me and thank you.
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Develop Apps Using App Designer dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!