Error while connecting from workspace to analog output of MyDaq

1 vue (au cours des 30 derniers jours)
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

Réponse acceptée

Joel Van Sickel
Joel Van Sickel le 10 Jan 2023
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 commentaires
Rachita Sarangi
Rachita Sarangi le 10 Jan 2023
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 le 10 Jan 2023
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

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Simulink Environment Customization dans Help Center et File Exchange

Produits


Version

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by