vector match warning statement
이전 댓글 표시
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
답변 (1개)
Walter Roberson
2020년 3월 7일
0 개 추천
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?
카테고리
도움말 센터 및 File Exchange에서 Mathematics에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!