First time matlab user problem Matrix dimensions must agree?
조회 수: 1 (최근 30일)
I'm a first time matlab user and I've run into a bit of a problem I keep getting an error. Here is my sequence of codes:
Error using .*
Matrix dimensions must agree.
Error in applyfilter (line 3)
Here is the script "applyfilter":
Any help would be appreciated thanks.
Image Analyst 2013년 4월 23일
What does derivefilter() return? You're not accepting any matrix for the filter that you can then pass in to applyfilter() instead of ans. You may need to have something like
myFilter = derivefilter(FREQSPEC,600);
but we can't tell until we know what's inside derivefilter().
추가 답변 (2개)
Leah 2013년 4월 23일
imgspec and filter must have the same dimension to do a element-wise multiplications
Jan 2013년 4월 23일
편집: Jan 님. 2013년 4월 23일
Your code would be easier to read, if you spend the time for reading the manuals for this forum and format the code properly.
It looks like:
imgspec .* filter
cannot work, because the array sizes do not match. This is surprising, because the value of filter seems to be a scalar.
Using ans explicitly is a bad idea, because this value is very volatile and debugging can change the value. filter is not a good choice also, because this is a name of an important built-in function.