Error while connecting from workspace to analog output of MyDaq
1 次查看(过去 30 天)
显示 更早的评论
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
0 个评论
采纳的回答
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 个评论
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 Exchange 中查找有关 Sources 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!