Info
Cette question est clôturée. Rouvrir pour modifier ou répondre.
comparing cells in excel then calculate for the sum
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
So I will try my best to explain this. So I need to find the sum of weight given chart,
I need Matlab go over each column (1-6) and grab valued x marked values and use it for calculation. Since I need the sum of weight, meaning W1+W2+W3....+W6 will bring the sum of the total weight. (here W1=10+13 and W2 = 10+13+8..etc) assuming that marked x can be marked differently for different cases how would I need to program this? I do have some idea that iteration has to be used but not too sure how I can grab certain xs for each column and calculate for Wi.How would I build this program by using while loop? Like i want to say While A(i) <= A(end) (here i am assuming A is a [1 2 3 4 5 6]) so it will check the case for each column. But how would command to matlab at that specific column (example 1), there are A and C and so on... please help! (the size is not always 6 it can be changed so you can't do A(i) <= 6)
Please help! (while loop demonstration would be great!)
0 commentaires
Réponses (1)
Star Strider
le 20 Fév 2018
I have no idea what you are starting with, since you did not post your chart in a form that we can read and use in a program.
If you can convert the chart to a matrix where it is possible to replace the ‘x’ values by 1 and the empty entries by 0, the maths are straightforward:
Cols = [1 0 1 0; 1 0 1 1; 1 1 0 1; 1 1 1 1; 1 1 0 0; 1 0 0 1]; % Create Matrix
Weight = [10; 11; 13; 8]; % Define Vector
Result = Cols * Weight
Result =
23
31
29
42
21
18
I cannot be certain that we can work with your chart if you do post it.
0 commentaires
Cette question est clôturée.
Voir également
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!