How to combine two matrix and extract value from one matrix to another matrix in same position?
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Repeated values in a matrix are assigned to a group and now the elements in group has to be matched with another matrix having probability values of element in group.
For example
a=[6 6 5 6 5 6 6]
group 1 =5
3 5
group 2 = 6
1 2 4 6 7
b = [0.74 0.66 0.58 0.47 0.62 0.75 0.76]
Expecting output:
group 1 = 5
0.58 0.62
group 2 = 6
0.74 0.66 0.47 0.75 0.76
Thank you in advance
0 comentarios
Respuestas (1)
Voss
el 20 de Mzo. de 2022
a = [6 6 5 6 5 6 6];
b = [0.74 0.66 0.58 0.47 0.62 0.75 0.76];
group_1 = 5;
group_2 = 6;
b(a == group_1)
b(a == group_2)
% Expecting output:
% group 1 = 5
% 0.58 0.62
% group 2 = 6
% 0.74 0.66 0.47 0.75 0.76
Ver también
Categorías
Más información sobre Logical 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!