使用这个函数info = imfinfo(mat2str(rec_art));以后一直在运行无法停止并得出结果、
时间: 2023-08-09 07:07:52 浏览: 134
这个函数 `imfinfo` 用于获取图像文件的元信息,包括图像大小、分辨率、颜色空间、图像类型等等。但是,您的代码中使用了 `mat2str` 函数将图像文件名转换为字符串,这可能会导致 `imfinfo` 函数无法正确识别图像文件,从而一直在运行而无法停止。
为了解决这个问题,您可以尝试直接将图像文件名作为函数参数,而不是使用 `mat2str` 转换为字符串。例如,可以使用以下代码获取图像文件的元信息:
```
info = imfinfo(rec_art);
```
如果您仍然遇到无法停止的问题,请检查图像文件名是否正确,以及图像文件是否存在。如果问题仍然存在,请尝试使用调试工具检查代码中的问题。
相关问题
错误使用 imfinfo (line 105) FILENAME 应为 字符串标量或字符向量。 出错 tupian (line 61) info = imfinfo(num2str(rec_art));%获取像素间距离
这个错误是因为在调用 imfinfo 函数时,传递给它的参数类型应该是字符串标量或字符向量,但是实际传递的却是其他类型。你需要检查一下代码,看看在调用 imfinfo 函数之前,是否有将参数转换为字符串标量或字符向量类型。如果没有,你可以使用 mat2str 函数将参数转换为字符串类型,例如:
```
info = imfinfo(mat2str(rec_art));
```
或者使用 num2str 函数将参数转换为字符串类型,例如:
```
info = imfinfo(num2str(rec_art));
```
这样就可以避免这个错误了。
错误使用 imfinfo (line 105) FILENAME 应为以下类型之一: char, string 但其类型为 double。 出错 tupian (line 61) info = imfinfo(rec_art);%获取像素间距离
这个错误是因为在调用 imfinfo 函数时,传递给它的参数类型应该是 char 或 string 类型,但是实际传递的却是 double 类型。你需要检查一下代码,看看在调用 imfinfo 函数之前,是否有将参数转换为 char 或 string 类型。如果没有,你可以使用 num2str 函数将参数转换为字符串类型,例如:
```
info = imfinfo(num2str(rec_art));
```
这样就可以避免这个错误了。
阅读全文
相关推荐
















