How to fix error in port widths or dimentions on the reshape block input?

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

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

Error in port widths or dimensions. ‘Output Port 1’ of ‘untitled/2-D IDCT’ is a [512x512] matrix.

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

I thought reshape was supposed to accept any matrix as an input.

ANSWER

Matlabsolutions.com provide latest MatLab Homework Help,MatLab Assignment Help for students, engineers and researchers in Multiple Branches like ECE, EEE, CSE, Mechanical, Civil with 100% output.Matlab Code for B.E, B.Tech,M.E,M.Tech, Ph.D. Scholars with 100% privacy guaranteed. Get MATLAB projects with source code for your learning and research.

The purpose of Simulink’s Reshape block and MATLAB’s reshape command is only to “reinterpret” the dimensions (aka size) of the signal/variable. The number of elements is not changed. The values as they would appear in the “flat memory” of the computer would also be unchanged.

Your usage doesn’t fit the reshape behavior. Your input to the first reshape block has this many elements.

inputNumel = prod([512,512,3])
inputNumel =
786432

Your desired output has this 1/3 as many elements.

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

Since you are trying to change then number of elements, the reshape block is throwing an error.

SEE COMPLETE ANSWER CLICK THE LINK

--

--

--

Simple! That is me, a simple person. I am passionate about knowledge and reading. That’s why I have decided to write and share a bit of my life and thoughts to.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

The State of Software Test Automation in 2020 — Survey Results

Working with Return Methods in Unity3D

Single Responsibility Principle

Need a guide for using vrtracer and/or 3D World Editor

[LeetCode][python3]Day21. Leftmost Column with at Least a One (30-Day LeetCoding Challenge)

How to start programming Computer Vision with OpenCV and IP Camera in Windows 10, Visual Studio…

Trustworthy way to get location on android

Cloud Drops — Introducing and Setting up Git LFS (Large File Storage)

Cloud Drops — Introducing and Setting up Git LFS (Large File Storage)

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Technical Source

Technical Source

Simple! That is me, a simple person. I am passionate about knowledge and reading. That’s why I have decided to write and share a bit of my life and thoughts to.

More from Medium

Could anyone help me with extracting similar features

Sandeep 😎😎😎

End to End Machine Learning with H2O.ai

Underwater soundwave for different starting angles