Assign values in a matrix
Afficher commentaires plus anciens
My script considers charging of Electric Vehicles. The first column is when the EV starts charging (in what minute), the second how much is charged, the third how long it charges. Example
3849 1 4
I would like to add values so the matrix looks like this, the values in the third column is now not relevant as it is expressed in per minute
3849 0.25 1
3850 0.25 1
3851 0.25 1
3852 0.25 1
2 commentaires
Jorg Woehl
le 8 Mar 2021
Hi Joel, I am not quite clear on what you would like to do... Do you want to change all values in the second column of your n-by-3 matrix to 0.25? Or is this a conditional assignment, like in "if the second column is 1, then change it to 0.25"? And reset the third column to 1 at the same time? Or do you want to "add values", like you are saying, i.e. add new rows to your matrix where the value in the first column (charging start time) increases by 1 from one row to the next?
Joel Schelander
le 8 Mar 2021
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Creating and Concatenating Matrices dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!