Import a picture in a workspace ,Unsupported input format for From Workspace

2 views (last 30 days)
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 Comments
Image Analyst
Image Analyst on 10 Jan 2023
Here are the formats it understands.
imformats
EXT ISA INFO READ WRITE ALPHA DESCRIPTION ----------------------------------------------------------------------------------------- bmp isbmp imbmpinfo readbmp writebmp 0 Windows Bitmap cur iscur imcurinfo readcur 1 Windows Cursor resources fts fits isfits imfitsinfo readfits 0 Flexible Image Transport System gif isgif imgifinfo readgif writegif 0 Graphics Interchange Format hdf ishdf imhdfinfo readhdf writehdf 0 Hierarchical Data Format ico isico imicoinfo readico 1 Windows Icon resources j2c j2k isjp2 imjp2info readjp2 writej2c 0 JPEG 2000 (raw codestream) jp2 isjp2 imjp2info readjp2 writejp2 0 JPEG 2000 (Part 1) jpf jpx isjp2 imjp2info readjp2 0 JPEG 2000 (Part 2) jpg jpeg isjpg imjpginfo readjpg writejpg 0 Joint Photographic Experts Group pbm ispbm impnminfo readpnm writepnm 0 Portable Bitmap pcx ispcx impcxinfo readpcx writepcx 0 Windows Paintbrush pgm ispgm impnminfo readpnm writepnm 0 Portable Graymap png ispng impnginfo readpng writepng 1 Portable Network Graphics pnm ispnm impnminfo readpnm writepnm 0 Portable Any Map ppm isppm impnminfo readpnm writepnm 0 Portable Pixmap ras isras imrasinfo readras writeras 1 Sun Raster svs istif imtifinfo readtif 0 Aperio ScanScope Virtual Slide tif tiff istif imtifinfo readtif writetif 0 Tagged Image File Format xwd isxwd imxwdinfo readxwd writexwd 0 X Window Dump
What is the format of your image?

Sign in to comment.

Answers (1)

Walter Roberson
Walter Roberson on 10 Jan 2023
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.
  2 Comments
wang
wang on 10 Jan 2023
This is where the picture is stored. All I have to do is pass in the image location and system2 reads the image information. But now I don't know how to do that

Sign in to comment.

Categories

Find more on Simulink Functions in Help Center and File Exchange

Products


Release

R2021b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!