Borrar filtros
Borrar filtros

How can I apply mathematical calculation for every Elements of a Cell Array ( like in Excel)

1 visualización (últimos 30 días)
Hi Matlab Masters, I have two following Cell Arrays (or two Excel-Tables, if necessary).
Cell Array for the Bodies
[Body] [Weigh] [warranty]
[A1] [3.5] [2]
[A2] [6.2] [3]
[B1] [7.1] [1]
[B2] [3,9] [4]
[B3] [4.2] [5]
[C1] [1.3] [7]
... .... ...
Cell Array for the partial Objects in each Body
[Object] [x_min] [x_max] [y_min] [y_max] [Volume]
[A1-a1] [5.7] [7.3] [8.9] [4.3] [5.1]
[A1-a2] [2.6] [5.6] [9.3] [5.7] [5.2]
[A1-a3] [3,6] [7.3] [5.3] [7.3] [5.8]
[A2-a1] [8,2] [5.8] [2.7] [5.3] [6.3]
[A2-a2] [8.4] [6.3] [8.5] [6.3] [9.3]
[B1-b1] [7.1] [6.3] [8.2] [8.5] [5.3]
[B1-b2] [8.9] [8.4] [4.5] [6.2] [4.5]
[C1-c1] [7.0] [7.1] [1.3] [8.9] [1.3]
[C1-c2] [6.9] [4.8] [3.2] [9.2] [3.7]
[C1-c3] [5.3] [2.5] [4.2] [6.4] [6.3]
... ... ... ... ... ...
now I want write a program, which does the following steps to the objects automatically:
1. Calculate the weigh of each object with the forular:
Weigh_obj = Weigh_body * Volume_obj/Sume of every Volume_obj in the body
for Example Weigh_A1-a1 = Weigh_A1 * Volume_A1-a1/(Volume_A1-a1 + Volume_A1-a2 + Volume_A1-a3)
= 3.5 * 5.1 /(5.1+5.2+5.8)
2. Compare the coordination of each object with the coordination of the other objects to find out,if there is a Touch between any two objects :
For Example with two Objects Object1 and Object2:
if ( (x2_min <=x1_min<=x2_max)or(x2_min <=x1_max<=x2_max)
and(y2_min <=y1_min<=y2_max)or(y2_min <=y1_max<=y2_max) )
returns '1' in corresponding positions in the matrix of n objects , like this:
[ X] [O1] [O2] [O3] ... [On]
[O1] [X] [1] [ ] ... ...
[O2] [1] [X] [ ] ... ...
[O3] [ ] [ ] [X] ... ...
... ... ... ... [X]
[On] ... ... ... ... [X]
else
returns '0' in the corresponding Positions in the matrix
end
so that in the end I get a full filled Object-matrix
I hope so, that I have explained my problem not so bad. 1000 Thanks for your concern !

Respuestas (0)

Categorías

Más información sobre Graphics Object Programming en Help Center y File Exchange.

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by