Matrix dimension must agree to use .*

1 vue (au cours des 30 derniers jours)
Neo
Neo le 31 Déc 2015
Commenté : Star Strider le 4 Jan 2016
I debugged my code and checked my workspace variables, and when I loaded in the two images their numbers were identical (matrix dimensions, their matrix dimensions after I manipulated them) yet when I use .* it still says an error because .* requires identical matrix dimensions, when, Q.E.D., that's what I have! Suggestions?
Cheers,
Neo Cornel

Réponse acceptée

Star Strider
Star Strider le 31 Déc 2015
Without knowing what the images are and seeing your code, it’s difficult to determine the problem. That they’re images means that they could have three dimensions (the third being the colour channels in a RGB image), and if one is a grayscale image having two dimensions, you could get that error even if they have the same number of rows and columns.
  21 commentaires
Image Analyst
Image Analyst le 4 Jan 2016
If you wanted to make copies of something. Like if you manually made up a 2-by-2 checkerboard and you wanted to replicate it to be a 8-by-8 checkerboard for example.
Star Strider
Star Strider le 4 Jan 2016
... or for a number of other reasons, for instance if you are using textscan and want to replicate a format descriptor without typing out each one, use repmat('%f',1,10) to replicate ‘%f’ 10 times.
It’s highly useful, although if you’re operating on a matrix with a vector element-wise, bsxfun is usually faster.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Matrix Indexing dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by