LogicAnalyser - Variable Number of inputs

1 回表示 (過去 30 日間)
Scott
Scott 2017 年 3 月 23 日
When using the DSP logic analyser the step method expects to receive N inputs where N is equal to the number of input ports specified when instanciating the scope
scope = dsp.LogicAnalyzer('NumInputPorts',3);
I'm trying create a script to plot data from the output of a Simulink model where there can be any number of inputs. The output from the simulink model is a "Stucture with Time" named yout.
data = [yout.signals.values]
Gives me the data i need, i can access each step by iterating though each row of data but I don't know how to pass all N signals for a single time step to the LogicAnalyzer object. data contains logical values.
Is there a method to pass the logic analyzer a variable number of data points? Perhaps as a vector?
The only solution I have come up with is to use eval to execute the step command with a string I create that contains 'data(t,1), data(t,2)... '

採用された回答

Bharath Venkataraman
Bharath Venkataraman 2017 年 3 月 24 日
Please take a look at the file analyzeLogicFromSimulink to see how to pass in the entire set of data at one go. This function creates and plots all the logged data from a Simulink simulation.
  3 件のコメント
Scott
Scott 2017 年 3 月 24 日
A slight improvement to add the output block names to the signals on the logic analyser.
function scope = LogicAnalyzerSignalNames(dataset)
% LogicAnalyserSignalNames
%
scope = analyzeLogicFromSimulink(dataset);
numElements = dataset.numElements;
for ii = 1:numElements
blkName = dataset.getElement(ii).BlockPath.getBlock(1);
scope.modifyDisplayChannel(ii,'Name',blkName);
end
end
Bharath Venkataraman
Bharath Venkataraman 2017 年 3 月 24 日
Glad it helped!

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeArray and Matrix Mathematics についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by