-1

我无法计算 和 的eye(100)乘积s = imread('1','gif')。矩阵的维数相等,但 MATLAB 注意到以下错误:

Error using .*
Integers can only be combined with integers of the same class, or scalar doubles.

如何s在 MATLAB 中定义为具有浮点值的矩阵?

4

1 回答 1

3

MATLAB返回一个包含类型元素(无符号 8 位整数)imread的矩阵。uint8与 相比eye(100),它产生一个类型为 的矩阵double。由于该操作.* 没有为不同类型的操作数定义,因此您需要在操作之前转换s为:double

s = double(imread('1', 'gif'));
于 2013-07-17T10:58:51.707 回答