Error in port widths or dimensions матлаб

Hi, I am getting error like"Error in port widths or dimensions. Output port 1 of 'Furutroo/Compensator/y' is a one dimensional vector with 4 elements." I am using state-space block with single i/p ...

Kaustubha Govind

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.


Guy Rouleau

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.


java python

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 .


Md Rakibul

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.

enter image description here

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

luckystrrrike's user avatar

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.

enter image description here

answered Apr 27, 2019 at 10:25

luckystrrrike's user avatar

1

Содержание

  1. Error in port widths or dimensions.
  2. Direct link to this question
  3. Direct link to this question
  4. Answers (1)
  5. Direct link to this answer
  6. Direct link to this answer
  7. See Also
  8. Categories
  9. Products
  10. Community Treasure Hunt
  11. How to Get Best Site Performance
  12. Americas
  13. Europe
  14. Asia Pacific
  15. Error in port widths or dimensions.
  16. Direct link to this question
  17. Direct link to this question
  18. Answers (1)
  19. Direct link to this answer
  20. Direct link to this answer
  21. See Also
  22. Categories
  23. Community Treasure Hunt
  24. How to Get Best Site Performance
  25. Americas
  26. Europe
  27. Asia Pacific
  28. how to fix Error in port widths or dimensions?
  29. Direct link to this question
  30. Direct link to this question
  31. Answers (1)
  32. Direct link to this answer
  33. Direct link to this answer
  34. See Also
  35. Categories
  36. Community Treasure Hunt
  37. How to Get Best Site Performance
  38. Americas
  39. Europe
  40. Asia Pacific
  41. Error in port widths or dimension
  42. Direct link to this question
  43. Direct link to this question
  44. Answers (0)
  45. See Also
  46. Categories
  47. Community Treasure Hunt
  48. How to Get Best Site Performance
  49. Americas
  50. Europe
  51. Asia Pacific
  52. Error in port widths or dimensions. ‘ SFunction ‘ in simulink
  53. Direct link to this question
  54. Direct link to this question
  55. Direct link to this comment
  56. Direct link to this comment
  57. Direct link to this comment
  58. Direct link to this comment
  59. Answers (1)
  60. Direct link to this answer
  61. Direct link to this answer
  62. See Also
  63. Categories
  64. Community Treasure Hunt
  65. How to Get Best Site Performance
  66. Americas
  67. Europe
  68. 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 block

Port 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
—> Error reported by S-function ‘sf_sfun’ in ‘initTest/chebyInit/chebyInit/ SFunction ‘:
Errors occurred during parsing of Embedded MATLAB function ‘chebyInit/chebyInit'(#161).
—> Error in port widths or dimensions.  Output port 1 of
‘initTest/chebyInit/chebyInit/chebyTcOrderVec’ is a one dimensional vector with 1 elements.

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;
        chebyTcSegEnd = 210;
        chebyTcOrderSca = 7;
        chebyTcOrderVec = 7;
        tSwitch = 20.1;
        orderMax = 9;

%% Profile 2

% Define the second set of conditions:
% Definition of the arbitary axis:
u2 = [3 0 1];
u2 = u2/norm(u2);
u2 = u2′;

%deffinition of the angle (a)
t2 = -1:0.01:1200;
a2 = sin(t2/100);

s2 = cos(a2/2);
u2 = u2* sin(a2/2);

qhist_B = [s2; u2];
qhist_B = qhist_B’;

% segStart_B = 200;
% segEnd_B = 1000;

% generate the coefficients
coeff1 =compute_chebychev_coef_v2(t2,qhist_B,1,chebyTcOrderSca+1,chebyTcSegStart,chebyTcSegEnd);
coeff2 =compute_chebychev_coef_v2(t2,qhist_B,2,chebyTcOrderVec+1,chebyTcSegStart,chebyTcSegEnd);
coeff3 =compute_chebychev_coef_v2(t2,qhist_B,3,chebyTcOrderVec+1,chebyTcSegStart,chebyTcSegEnd);
coeff4 =compute_chebychev_coef_v2(t2,qhist_B,4,chebyTcOrderVec+1,chebyTcSegStart,chebyTcSegEnd);

%Define the input values for profile 2
chebyTcCoefSca = coeff1;
chebyTcCoefVec = [coeff2, coeff3, coeff4];

%% run Init Block
sim initTest

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Resources

Low-Volume Rapid Injection Molding With 3D Printed Molds

Learn 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

Design for Additive Manufacturing (DfAM)

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

Industry Perspective: Education and Metal 3D Printing

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

Taking Control of Engineering Documents

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:

  • Eng-Tips ForumsTalk 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

Понравилась статья? Поделить с друзьями:
  • Error in pol shortcut playonlinux
  • Error in plugin webpack stream
  • Error in plugin gulp webp
  • Error in plugin gulp svg sprite
  • Error in plugin gulp sass