how to multiply cell with a vector such that cell contains a matrix and each row is multiplied by different element of vector?
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
summyia qamar
el 18 de En. de 2017
Respondida: James Tursa
el 18 de En. de 2017
A={[10 0 0 10 0 20 15;
0 10 10 15 0 0 20;
10 0 0 12 11 0 0;
10 0 0 0 19 0 14;
18 13 0 0 0 15 0;
0 10 0 0 0 10 15]
[0 0 10 0 20 15;
10 10 15 0 0 20;
0 0 12 11 0 0;
0 0 0 19 0 14;
13 0 0 0 15 0;
11 0 13 0 15 0]}
B=[500 550 600 650 700 550]
I want to multiply each matrix with this vector in a way that 1st row is multiplied by 1st element of B 2nd row with 2nd element and 6th row with 6th element. how to define this as A is a cell
0 comentarios
Respuesta aceptada
James Tursa
el 18 de En. de 2017
It is not clear to me what you want to have happen to rows 3-5. Assuming it is similar to the other rows, does this do what you want?
C = cellfun(@(x)bsxfun(@times,x,B(:)),A,'uni',false);
0 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Logical 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!