How to fix error in port widths or sizes in reshape block input?

I need to do DCT image compression in Simulink. Image size has 3 dimensions by default so I used the reshape tool to remove the third dimension. The Color Space Conversion tool only accepts 3D images, so I used the reshape again.

When I try to run the simulation I get the following two errors:

Error in port widths or sizes. ‘Output Port 1’ of ‘Untitled/2-D IDCT’ is a [512×512] matrix.

Error in port widths or sizes. ‘Input Port 1’ of ‘untitled/Reshape1’ has 786432 items. This port does not accept dimensions (or orientation) specified by the input signal.

I thought the reshape should accept any matrix as input.

REPLY

Matlabsolutions.com provides the latest MatLab Homework Help, MatLab Assignment Help with 100% output for students, engineers and researchers in Multiple Majors like ECE, EEE, CSE, Mechanics, Construction. Matlab Code for BE, B.Tech, ME, M.Tech, PhD academics with 100% confidentiality guarantee. Get MATLAB projects with source code for your learning and research.

The purpose of Simulink’s Reshape block and MATLAB’s reshape command is simply to “reinterpret” the dimensions (aka size) of the signal/variable. The number of elements does not change. The values ​​that will appear in the computer’s “plain memory” will also not change.

Your usage doesn’t match the reshape behavior. You entered the first reshape block has this many elements.

inputNumber = product ([512,512,3]) inputNumel = 786432

There are as many elements as this 1/3 of the output you want.

outputNumel = product([512,512]) outputNumel = 262144

The reshape block throws an error because you then try to change the number of elements.

CLICK THE LINK TO VIEW FULL ANSWER

NEXT ARTICLE Next Post
PREVIOUS ARTICLE Previous Post
NEXT ARTICLE Next Post
PREVIOUS ARTICLE Previous Post