how should I do when I want to input matrix of logical type into from workspace block in simulink.

2 visualizzazioni (ultimi 30 giorni)
Dear Sir or Madam,
I would like to input matrix of logical type into from workspace block or other block that have similar function in simulink.
But, the from workspace block can't be received logical type.
I'm glad if you tell me the way.
Sincerely,

Risposte (1)

Prashant Arora
Prashant Arora il 20 Ott 2017
Hi Shunsuke,
To Workspace block does allow you to have logical data into Simulink. That data however, should represent a signal, for example has a relation with simulation time. To do this (using Matrix format), you need to define the MATLAB workspace variable as [t data], where t is the first column and represents time. Consider the following code:
t = 0.2*[0:50]'; %Time Step of 0.2 seconds and Simulation time 10 seconds
% Data represents rows = number of time samples,
% and each column represent data corresponding to that time
data = logical(randi([0 1],numel(t),100));
simin = [t data];
Using this simin variable in the From Workspace variable, you can get a multi dimensional signal(100 dimensions).

Community Treasure Hunt

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

Start Hunting!