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

3 views (last 30 days)
Ammar MRABTI
Ammar MRABTI on 8 Jan 2022
Commented: Image Analyst on 8 Jan 2022
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

Answers (1)

Image Analyst
Image Analyst on 8 Jan 2022
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 Comments
Image Analyst
Image Analyst on 8 Jan 2022
You forgot to tell us the dimensions - the results from the whos commands. Did you try what I suggested?

Sign in to comment.

Products


Release

R2009a

Community Treasure Hunt

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

Start Hunting!

Translated by