How to turn assigned vectors into a 3x3 matrix?
조회 수: 11 (최근 30일)
이전 댓글 표시
How do I turn these vectors into a 3x3 matrix? I am new at MATLab, so any help would be appreciated!
vec1 = [1,2,4]
vec2 = [5,6,8]
vec3 = 1:2:11
댓글 수: 0
답변 (1개)
James Tursa
2019년 9월 20일
편집: James Tursa
2019년 9월 20일
Assuming vec3 is a typo,
result = [vec1;vec2;vec3];
If you need to, you can transpose the result.
If your vec3 is not a typo, then you have too many elements in vec3 to make it part of the 3x3 matrix.
댓글 수: 2
James Tursa
2019년 9월 20일
Think about it. vec1 has three elements, vec2 has three elements, and vec3 as written has six elements. How can you fit all of those into a 3x3 matrix? What is the actual wording of the assignment?
참고 항목
카테고리
Help Center 및 File Exchange에서 Logical에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!