Reputation: 459
I have an m-by-n matrix where n is large. I want to visualize it by using the range of values in each column, i.e. I want to visualize the whole matrix in one image but each column will have its own range. It is like applying columnwise imagesc and concatenating each column in the end.
Is there an efficient way to do this?
Upvotes: 0
Views: 105
Reputation: 21561
I think that a columnwise normalization should do the trick before you use imagesc.
Suppose you have an image called original
.
original = rand(10,5);
First get the range of each column:
myMax = max(original);
myMin = min(original);
myDiff = myMax-myMin;
Then we shift it down to the appropriate level
newimage = bsxfun(@minus,original,myMin);
Finally we rescale it to the appropriate scale:
newimage = bsxfun(@rdivide,newimage ,myMax - myMin);
Now you can just apply imagesc to your newimage
and I think this will give you what you need.
Note that you may want to add another step if the maximum and minimum can be equal to eachother.
Upvotes: 2