How can I create a multidimensional array from two vectors that have different dimensions using a for loop?
8 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Guillermo Naranjo
el 13 de Sept. de 2018
Comentada: Guillermo Naranjo
el 14 de Sept. de 2018
Hi I’m trying to create the following matrix from two vectors
A=1:2
B=4:7
C=[
1 4
1 5
1 6
1 7
2 4
2 5
2 6
2 7]
Using a for loop So far I have
A=1:2
B=4:7
For i=1:2
For j=1:4
C(i,j)= [A(i) B(j)]
End
End
After that I get a dimensional error. Any suggestions?
2 comentarios
Respuesta aceptada
Más respuestas (0)
Ver también
Categorías
Más información sobre Multidimensional Arrays 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!