How do you create a Stateflow Chart with inputs and outputs being vectors, which change every timestep?
    6 vues (au cours des 30 derniers jours)
  
       Afficher commentaires plus anciens
    
Hello,
I want to create a Stateflow chart with inputs and outputs as vectors. Each element of the input vectors should be tested by conditions and output a different state. All elements should be tested in one timestep and that repeats for the next timesteps. It should work similar to this for+if loop:
function ov_wt = fcn(Ref,k1, PH)
ov_wt=zeros(PH,1);
for n=1:PH
    if Ref(n,3)>=k1(n,1)
        ov_wt(n,1)=100;
    else
        ov_wt(n,1)=50;
    end
end
Basically i want to create a vector, which is able to look in the future based on the input vectors, that also preview the future. 
Thanks!
0 commentaires
Réponses (1)
  Benjamin Thompson
      
 le 5 Oct 2022
        When you add an input or output to a chart block in the Simulink model, you can set the size to something other than -1.
But maybe a for iterator subsystem would be better for what you are trying to do.  Put an if action subsystem inside there to implement your if/else functionality.
0 commentaires
Voir également
Catégories
				En savoir plus sur Simulink Functions dans Help Center et File Exchange
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

