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!
