Your input to the State-Space block has a dimension of 1×4, but B has dimensions 2×2 — this doesn’t make sense because you can’t multiple a 2×2 matrix with a 1×4 vector. Your input must be a vector of 2 elements as Guy suggested.
I don’t know where the 4 comes from in your error message, but your B and D matrices have 2 columns, so your system should have 2 inputs.
Try leaving unconnected or grounded lines where the error is and display the signal width (from the format menu). this should help understanding what’s going on.
I have a simulink model of UAV model which ran fine in 2010b and 2012a model in my school’s computer. But when run exact same block in 2012b, it guves me the error message ,»Error in port widths or dimensions. Output port 1 of ….» . In the bottom window, it says «Error in port widths or dimensions. Input port 1 of ‘sldSim/sldDynamics/MATLAB Fcn’ has 17 elements. This port does not accept the dimensions (or orientation) specified by the input signal.»
I don’t see any non-uniformity with the dimensions. Even if there was a problem why would it run in previous versions ? Does 2012b simulink has any bugs ? Please help me .
I have similar problem but not related to input/matrix size. One of my file works in my workplace MATLAB but does not work in my personal laptop. it gives «Error in port widths or dimensions. Output port 1 of ‘ueki1/control+robot/robot/f1/Invm*(tau-C-g)’ has 3 elements. This port does not accept the dimensions (or orientation) specified by the output signal.» But I know there are no errors in dimensions. Previously I solved this problem by removing extra sign in summation block. Lets say you added 3 inputs in summation block. Then you decided to remove one input but kept the summation block as +++ instead of ++ which gives problem in dimension. It worked last time. But this time still been trying to look in the file for the same issue. But did not find anything like that. Any Idea please GUY or Kausthuba?
The Matlab function named C
generates a matrix with 3×3 dimension. I have to product it with the vector 1×3 made with the mux of sources n_x
, n_y
, n_z
.
However, running this model causes two errors:
Error in port widths or dimensions. Invalid dimension has been
specified for input port 2 of ‘untitled/Product’.Error in port widths or dimensions. Output port 1 of ‘untitled/C’ is a
[3×3] matrix.
Could you please explain me what’s wrong with it?
asked Apr 27, 2019 at 9:46
The problem is solved. All I had to do is to swap the production block inputs and set the Matrix*
value in «Multiplication» property in the block settings.
answered Apr 27, 2019 at 10:25
1
Содержание
- Error in port widths or dimensions.
- Direct link to this question
- Direct link to this question
- Answers (1)
- Direct link to this answer
- Direct link to this answer
- See Also
- Categories
- Products
- Community Treasure Hunt
- How to Get Best Site Performance
- Americas
- Europe
- Asia Pacific
- Error in port widths or dimensions.
- Direct link to this question
- Direct link to this question
- Answers (1)
- Direct link to this answer
- Direct link to this answer
- See Also
- Categories
- Community Treasure Hunt
- How to Get Best Site Performance
- Americas
- Europe
- Asia Pacific
- how to fix Error in port widths or dimensions?
- Direct link to this question
- Direct link to this question
- Answers (1)
- Direct link to this answer
- Direct link to this answer
- See Also
- Categories
- Community Treasure Hunt
- How to Get Best Site Performance
- Americas
- Europe
- Asia Pacific
- Error in port widths or dimension
- Direct link to this question
- Direct link to this question
- Answers (0)
- See Also
- Categories
- Community Treasure Hunt
- How to Get Best Site Performance
- Americas
- Europe
- Asia Pacific
- Error in port widths or dimensions. ‘ SFunction ‘ in simulink
- Direct link to this question
- Direct link to this question
- Direct link to this comment
- Direct link to this comment
- Direct link to this comment
- Direct link to this comment
- Answers (1)
- Direct link to this answer
- Direct link to this answer
- See Also
- Categories
- Community Treasure Hunt
- How to Get Best Site Performance
- Americas
- Europe
- Asia Pacific
Error in port widths or dimensions.
Direct link to this question
Direct link to this question
0 Comments
Answers (1)
Direct link to this answer
Direct link to this answer
0 Comments
See Also
Categories
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
An Error Occurred
Unable to complete the action because of changes made to the page. Reload the page to see its updated state.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
Читайте также: Steam vr ошибка при подключении дисплея
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- Deutsch
- English
- Français
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 简体中文 Chinese
- English
- 日本 Japanese (日本語)
- 한국 Korean (한국어)
Accelerating the pace of engineering and science
MathWorks is the leading developer of mathematical computing software for engineers and scientists.
Источник
Error in port widths or dimensions.
Direct link to this question
Direct link to this question
0 Comments
Answers (1)
Direct link to this answer
Direct link to this answer
0 Comments
See Also
Categories
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
An Error Occurred
Unable to complete the action because of changes made to the page. Reload the page to see its updated state.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- Deutsch
- English
- Français
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 简体中文 Chinese
- English
- 日本 Japanese (日本語)
- 한국 Korean (한국어)
Accelerating the pace of engineering and science
MathWorks is the leading developer of mathematical computing software for engineers and scientists.
Читайте также: Error interface init fail
Источник
how to fix Error in port widths or dimensions?
Direct link to this question
Direct link to this question
0 Comments
Answers (1)
Direct link to this answer
Direct link to this answer
0 Comments
See Also
Categories
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
An Error Occurred
Unable to complete the action because of changes made to the page. Reload the page to see its updated state.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- Deutsch
- English
- Français
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 简体中文 Chinese
- English
- 日本 Japanese (日本語)
- 한국 Korean (한국어)
Accelerating the pace of engineering and science
MathWorks is the leading developer of mathematical computing software for engineers and scientists.
Источник
Error in port widths or dimension
Direct link to this question
Direct link to this question
0 Comments
Answers (0)
See Also
Categories
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
An Error Occurred
Unable to complete the action because of changes made to the page. Reload the page to see its updated state.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Читайте также: Postgresql raise exception example
Americas
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- Deutsch
- English
- Français
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 简体中文 Chinese
- English
- 日本 Japanese (日本語)
- 한국 Korean (한국어)
Accelerating the pace of engineering and science
MathWorks is the leading developer of mathematical computing software for engineers and scientists.
Источник
Error in port widths or dimensions. ‘ SFunction ‘ in simulink
Direct link to this question
Direct link to this question
2 Comments
Direct link to this comment
Direct link to this comment
Direct link to this comment
Direct link to this comment
Answers (1)
Direct link to this answer
Direct link to this answer
0 Comments
See Also
Categories
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
An Error Occurred
Unable to complete the action because of changes made to the page. Reload the page to see its updated state.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- Deutsch
- English
- Français
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 简体中文 Chinese
- English
- 日本 Japanese (日本語)
- 한국 Korean (한국어)
Accelerating the pace of engineering and science
MathWorks is the leading developer of mathematical computing software for engineers and scientists.
Источник
Semenov asked . 2021-09-28
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. ‘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.
simulink , reshape , dct ,error , image compression
Prashant Kumar answered . 2023-02-09 14:01:19
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.
One approach to solve this is to put the following code into a MATLAB Function block
function [Y,Cb,Cr] = splitData(u) Y = u(:,:,1); Cb = u(:,:,2); Cf = u(:,:,3); end
But there is probably a simpler way to achieve your high level goal using capabilities of Image Processing Toolbox.
Not satisfied with the answer ?? ASK NOW
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS
Contact US
Thanks. We have received your request and will respond promptly.
Log In
Come Join Us!
Are you an
Engineering professional?
Join Eng-Tips Forums!
- Talk With Other Members
- Be Notified Of Responses
To Your Posts - Keyword Search
- One-Click Access To Your
Favorite Forums - Automated Signatures
On Your Posts - Best Of All, It’s Free!
*Eng-Tips’s functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.
Posting Guidelines
Promoting, selling, recruiting, coursework and thesis posting is forbidden.
Students Click Here
Port Dimensions error, embedded Matlab/constant blockPort Dimensions error, embedded Matlab/constant block(OP) 8 Jun 09 06:38 Hi, I hope you can help. I am trying to set up a test of an imbedded Matlab function I have produced. I have it set up with a series of constant blocks that get their values from an initialisation script. Whenever I run it, I get the following error: ??? Error using ==> sim ChebyTcOrderVec is an input port which gets its values from a constant block of the same name and which I would expect to be a 1 dimensional vectore with one element as it just takes in an integer value. The code for the set up is below, I’m not sure how helpful it will be. All the variables in the script below are then used as constant values from constant blocks. If you need any more information please do let me know as I am stumped and would really appreciate some assistance. Thanks, Robyn %% Set up Case Specific Values chebyTcSegStart = 19; %% Profile 2 % Define the second set of conditions: %deffinition of the angle (a) s2 = cos(a2/2); qhist_B = [s2; u2]; % segStart_B = 200; % generate the coefficients %Define the input values for profile 2 %% run Init Block Red Flag SubmittedThank you for helping keep Eng-Tips Forums free from inappropriate posts. |
ResourcesLearn methods and guidelines for using stereolithography (SLA) 3D printed molds in the injection molding process to lower costs and lead time. Discover how this hybrid manufacturing process enables on-demand mold fabrication to quickly produce small batches of thermoplastic parts. Download Now Examine how the principles of DfAM upend many of the long-standing rules around manufacturability — allowing engineers and designers to place a part’s function at the center of their design considerations. Download Now Metal 3D printing has rapidly emerged as a key technology in modern design and manufacturing, so it’s critical educational institutions include it in their curricula to avoid leaving students at a disadvantage as they enter the workforce. Download Now This ebook covers tips for creating and managing workflows, security best practices and protection of intellectual property, Cloud vs. on-premise software solutions, CAD file management, compliance, and more. Download Now |
Join Eng-Tips® Today!
Join your peers on the Internet’s largest technical engineering professional community.
It’s easy to join and it’s free.
Here’s Why Members Love Eng-Tips Forums:
Talk To Other Members
- Notification Of Responses To Questions
- Favorite Forums One Click Access
- Keyword Search Of All Posts, And More…
Register now while it’s still free!
Already a member? Close this window and log in.
Join Us Close