Error while connecting from workspace to analog output of MyDaq

1 回表示 (過去 30 日間)
Rachita Sarangi
Rachita Sarangi 2023 年 1 月 9 日
コメント済み: Joel Van Sickel 2023 年 1 月 10 日
Error evaluating registered method 'SetInputPortDimensions' of MATLAB S-Function 'saob' in 'untitled/Analog Output'. The following is the MATLAB call stack (file names and line numbers) that produced this error: ['C:\Program Files\MATLAB\R2022a\toolbox\daq\daqblks\daqsfcn\saob.m'] [160] ['C:\Program Files\MATLAB\R2022a\toolbox\simulink\ui\studio\config\m\+SLStudio\StartPauseContinue.p'] [0] ['C:\Program Files\MATLAB\R2022a\toolbox\simulink\ui\studio\config\m\+SLStudio\ToolBars.p'] [0]
Caused by:
  • The input of input port 1 needs to be a 1-D scalar, or a 2-D matrix of size N-by-2.
Component:Simulink | Category:Model error
Error in port widths or dimensions. 'Output Port 1' of 'untitled/From Workspace' is a one dimensional vector with 1000000 elements.
Component:Simulink | Category:Model error

採用された回答

Joel Van Sickel
Joel Van Sickel 2023 年 1 月 10 日
It looks like your value of x has 1,000,000 dimensions. Is it a vector based on time? THe constant block should have a scalar put in to it to work. If you want the play a vector that changes over time, you'll need to use a different block like the from workspace block.
  2 件のコメント
Rachita Sarangi
Rachita Sarangi 2023 年 1 月 10 日
Thank you for your reply. However I was trying to load the data in x into the from work space block. Will it work?
Joel Van Sickel
Joel Van Sickel 2023 年 1 月 10 日
sorry, I missed that. The issue is probably that you don't have a time domain vector with x, so x was read in as 1 million element vector with 1 sample per element (instead of a 1 element vector with 1 million samples). If you transpose x into a column vector, and add a time vector, the from workspace should work.
You could also try reading directly from the spreadsheet. You will need to reformat your spreadsheet and again, add a time stamp: https://www.mathworks.com/help/simulink/slref/fromspreadsheet.html

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSimulink Environment Customization についてさらに検索

タグ

製品


リリース

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by