# Scenario/validate > Validate a Scenario object --- ## Description Validate the properties of a Scenario object to ensure that they meet the required conditions. If all the conditions are satisfied, the function returns a Scenario object with `valid = true`. If not, corresponding error message is raised. ## Syntax ```matlab scenario = validate(scenario) scenario = scenario.validate() ``` ## Input Arguments | Name | Type | Description | |------|------|--------------| | `scenario` | *Scenario object* | Scenario object to be validated | ## Output Arguments | Name | Type | Description | |------|------|--------------| | `scenario` | *Scenario object* | Validated Scenario object | ## Required conditions For a Scenario object to be valid, the following conditions must be satisfied. ### EVs * If `EVs` is nonempty, each EV object in it must be valid. (SEE ALSO EV OR EV.VALIDATE) ### Compatibility * If `Problem_type == "Lf"`, then `D` must be nonempty. * If `Problem_type == "Uf"`, then `C` must be nonempty. * `N_c` must be greater than or equal to the maximum value of `Charger_ind` of EV objects in `EVs`. * `N_ev` must be equal to the length of `EVs` * `N_g` must be greater than or equal to the maximum value of `Group_ind` of EV objects in `EVs`. * For EV objects in `EVs` with same `Charger_ind` value, their occupancy must not overlap, i.e., vectors `Arr_time:(Dep_time-1)` must not have common elements. ### Dimension * If nonempty, length of `D` must be `T`. * If nonempty, length of `C` must be `T`. * If nonempty, size of `L` must be `(N_c+1)×(N_c+1)`. * If nonempty, size of `W` must be `N_c×N_c`. ### Graph-related * If nonempty, `L` must be a symmetric matrix with zero row sums and nonnegative diagonal elements. * If nonempty, `W` must be a symmetric stochastic matrix.