# empty signal coming into minimum block problem

3 views (last 30 days)
Mat Nub on 31 Jan 2013
I have a Find non-zero block connected Min block. Find non-zero outputs a variable size matrix that shrinks for one element in every step because this is part of a switch off algorithm based on minimum value. Because switch off is in loop with non-zero block this means that in final step when everything is switched off the non-zero sends and empty signal to Min block and this gives error "The signal at input port 1 of 'Min' cannot have an empty size" I would like to simulation to finish by terminating the swich off operation and ending the algorithm without this error.

Kaustubha Govind on 31 Jan 2013
Not sure if this is what you're looking for, but you can use the Stop block to stop simulation based on an input condition.

Mat Nub on 2 Feb 2013
Hi Kaustubha, thanks you very much for replying.
Stop doesn't really help but let me try to explain the system in more physical sense. I have 4 power generators (real current sources) with ideal switches that I control via previously mentioned algorithm. The goal of simulation is to see them shut down in cascaded manner by minimum power production increment. Each unit has different power output and system needs to disconnect the minimal one in each step. Control algorithm uses power output inputs in decision making and finding minimum. Problem with this kind of setup is once you have a unit shut down and going to zero, it still participates as input in the min block. In other words it is a false minimum that will always trick controller into sending switch off signal to a unit that is already switched off. As final result, you only get one unit switched off and the rest remain in production till the end of simulation instead of shutting down one by one. I tried fixing this by putting find nonzero block in front of min block, but this creates several problems some of which I described in my first post. I think the question boils down to this: how do I get rid of the false minimum without using find nonzero block? Is there an alternative in the library or I must make a custom Matlab block?

### Categories

Find more on Sources in Help Center and File Exchange

### Community Treasure Hunt

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

Start Hunting!