i need help with an older version of matlab, i don't understand the error message

조회 수: 1 (최근 30일)
hello everyone, i'm not really good with matlab software but i can manage to code a little on matlab r2021, but due to somework related problems i have to work on a code writting in matlab r2009, and i have this error that i don't know how to deal with it, so if anyone could guide me i'll appreciate it , thanks in advance

답변 (1개)

Image Analyst
Image Analyst 2022년 1월 8일
metrique2 is a matrix with rows and columns, let's call them R and C.
metrique2(i, :) or metrique2(j, :) is the i'th or j'th row of that matrix. So it's a row vector with 1 row and C columns.
metrique2(i, :)' or metrique2(j, :)' transposes that row vector into a column vector. So it's a column vector with C rows and 1 column.
Now, when you construct a new matrix using a space or comma between the terms, it stitched them together horizontally. So that means that they must all have the same number of rows. You can't stitch a 10x1 vector onto a 99x1 vector because the bottom would be "ragged" which is not allowed.
Now we know that metrique2(i, :)' and metrique2(j, :)' defintely both have C rows, so the error is saying that I1 does not have C rows. Perhaps it is a row vector instead of a column vector. Perhaps it has as many elements as rows in metrique2 instead of as columns as metrique2. I don't know. How do we find out. Put these lines before the line that throws the error
whos metrique2
whos I1
  댓글 수: 3
Ammar MRABTI
Ammar MRABTI 2022년 1월 8일
@Image_Analyst thank you so much for the clarification , it really helped me . like i said i'm not a good user of matlab so i wouldn't now , thank you
Image Analyst
Image Analyst 2022년 1월 8일
You forgot to tell us the dimensions - the results from the whos commands. Did you try what I suggested?

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Matrix Indexing에 대해 자세히 알아보기

제품


릴리스

R2009a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by