Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我无法计算 和 的eye(100)乘积s = imread('1','gif')。矩阵的维数相等,但 MATLAB 注意到以下错误:
eye(100)
s = imread('1','gif')
Error using .* Integers can only be combined with integers of the same class, or scalar doubles.
如何s在 MATLAB 中定义为具有浮点值的矩阵?
s
MATLAB返回一个包含类型元素(无符号 8 位整数)imread的矩阵。uint8与 相比eye(100),它产生一个类型为 的矩阵double。由于该操作.* 没有为不同类型的操作数定义,因此您需要在操作之前转换s为:double
imread
uint8
double
.*
s = double(imread('1', 'gif'));