Matlab中的imagesc函数 [英] imagesc function in Matlab

查看:1111
本文介绍了Matlab中的imagesc函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近在看imagesc函数:

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

imagesc函数可以执行此操作吗?因为到目前为止,我只能得到彩色正方形?

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

我尝试过:

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

然后.

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>

使用图片时出错 图片CData所需的数字或逻辑矩阵

Error using image Numeric or logical matrix required for image CData

imagesc中的错误(第19行) hh = image(varargin {1},'CDataMapping','scaled');

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

推荐答案

如果使用colormap(gray(256)),则在imagesc之前会为您提供灰度图像

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

这篇关于Matlab中的imagesc函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆