[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Function works with number literal but not with variable
From: |
George |
Subject: |
Function works with number literal but not with variable |
Date: |
Wed, 16 Dec 2009 11:36:58 +0000 |
imshow doesn't work if an image contains both positive and negative
values. So I tried to write a wrapper for imshow that will scale the
image so that all the elements are positive. So I call imshow from
within my function. The problem is that it doesn't work if I pass the
limits from variables, but it works if I type them as numbers. So this
code doesn't work:
minVal = min(min(image));
maxVal = max(max(image));
[rows, columns] = size(image);
normalized = image - ones(rows,columns) * (minVal);
minVal = min(min(normalized));
maxVal = max(max(normalized)); % for my test image this is 44.2, I
can see it if I remove the semicolon
imshow(normalized, [0, maxVal]);
But it works if I change the last line to this:
imshow(normalized, [0, 44.2]);
Two questions here:
Why does this happen?
Why doesn't imshow work with images that have both positive and negative values?
- Function works with number literal but not with variable,
George <=
- Re: Function works with number literal but not with variable, George, 2009/12/16
- Re: Function works with number literal but not with variable, John W. Eaton, 2009/12/16
- Re: Function works with number literal but not with variable, George, 2009/12/16
- Re: Function works with number literal but not with variable, John W. Eaton, 2009/12/16
- Re: Function works with number literal but not with variable, George, 2009/12/16
- Re: Function works with number literal but not with variable, John W. Eaton, 2009/12/16
- Message not available
- Re: Function works with number literal but not with variable, George, 2009/12/16
- Re: Function works with number literal but not with variable, Judd Storrs, 2009/12/16
Re: Function works with number literal but not with variable, Sergei Steshenko, 2009/12/16