vector match warning statement
Mostrar comentarios más antiguos
In matlab the user to enter multiple concentrated forces [N/m] and the locations of each of the forces on the beam [m] as vectors. If the number of locations is not equal to the number of forces entered, produce a warning and prompt the user to re-enter the locations of the forces until the correct number of locations are entered.
my code
concentreated vector=[2 3 4 3[
location vector=[4 5 3 3]
Question
how do I produce a warning if the first vector does not equal the second
Respuestas (1)
Walter Roberson
el 7 de Mzo. de 2020
0 votos
Compare numel() the two variables to see if the same number of elements is used.
However, I recommend that you consider what should happen if the user enters two 2d arrays that have the same number of elements but a different shape, such as 2 x 6 in one case and 4 x 3 in the other. That satisfies the condition that the same number of elements are entered, but does it make sense to proceed?
Categorías
Más información sobre Mathematics en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!