imagesc function in Matlab

1.9k views Asked by At

I was recently looking at the imagesc function on:

http://www.mathworks.co.uk/help/matlab/ref/imagesc.html

What I want to do is take a square matrix of anything, doesn't matter what, integers, characters etc. and produce an image of it so that I can draw over the top of it i.e. so it produces an image like this:

http://iching.egoplex.com/faq.html

Can the imagesc function do this? Because trying it so far, I have only been able to get multicoloured squares?

Edit: I tried:

a = ['a','b','c';'d','e','f';'g','h','i']

and then.

imagesc(a)

But all I got was a blank graph and:

{ Error using <a href="matlab:helpUtils.errorDocCallback('image')" style="font-weight:bold">image</a>

Error using image Numeric or logical matrix required for image CData

Error in imagesc (line 19) hh = image(varargin{1},'CDataMapping','scaled');

1

There are 1 answers

0
MalikAnasAhmad On

if you use colormap(gray(256)), before imagesc it will givee you a grayscale image