How to split data into cell
显示 更早的评论
In the given excel I have 4 columns I want to split the data with respect to column 1 name as minutes and save the data of the other corresponding columns name with D1, D2, D3.
the condition should be that the data start from zero in column 1 and select the data upto next zero occure. save this data in one cell and again start saving data start from the next zero upto another zero occure.
7 个评论
Rik
2021-10-27
A naive approach would be to do this with a loop row by row. When you have working code with a loop it will be likely be easy to speed this up (e.g. with something like find(data>0,1,'first')).
What did you try?
Adil Sardar
2021-10-27
编辑:Rik
2021-10-27
Rik
2021-10-27
Write it out: what should happen when? What should be done for each row?
If the value of minute is 0, start a new cell and make that the current cell. If not, stay in the current cell.
Then add the value of your data to the current cell.
How would you write this in code? Also, please use the layout options of the editor.
Adil Sardar
2021-10-27
Adil Sardar
2021-10-27
Adil Sardar
2021-10-27
Rik
2021-10-27
I understand what you want, now I want to see if you can translate the text I wrote to code. Think of what should happen step by step. Can you understand why the code you posted didn't work?
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Loops and Conditional Statements 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
