Import a picture in a workspace ,Unsupported input format for From Workspace
4 次查看(过去 30 天)
显示 更早的评论
img_path is the selected picture in MATLAB.Image input to system2.
Unsupported input format for From Workspace block 'sy3/From Workspace'. Available formats are double non-complex matrix, a structure with or without time, or a structure with MATLAB timeseries as leaf nodes. All formats require the data to be finite (not Inf or NaN).
3 个评论
Image Analyst
2023-1-10
Here are the formats it understands.
imformats
What is the format of your image?
回答(1 个)
Walter Roberson
2023-1-10
The From Workspace block does not permit specifying a file name. It has no capacity to read images itself. It does not support any image type.
From Workspace does support 2D arrays of double, but when you use that, the first column of the array must be times, and the remaining columns are the signal values at that time.
The model you show the diagram appears to be using two MATLAB Function Blocks, one of which, System2, appears to be accepting an image path as a signal, and appears to be emitting the image data, and the number of rows and columns, and an additional value that is not clear. The second MATLAB Function Block, System3, appears to be accepting the rows and columns, and mystery parameter, and processing them to do something that results in image data.
The error message you posted is for a From Workspace block named sy3 which does not appear in your model -- not unless sy3 is what is marked as img_path .
If you are trying to use From Workspace to load an image file name, you have a problem that a file name is not a time-based signal, and is not one of the datatypes that From Workspace handles. I suggest that instead you use a String Constant https://www.mathworks.com/help/simulink/slref/stringconstant.html -- which you can set_param at the MATLAB level.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Simulink Functions 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!