Assign values in a matrix
이전 댓글 표시
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
Jorg Woehl
2021년 3월 8일
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
2021년 3월 8일
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!