MATLAB Answers

How to combine hours from a cell and minutes from another cell into one cell of Time ?

4 ビュー (過去 30 日間)
Add 2016 年 5 月 17 日
コメント済み: Add 2016 年 5 月 18 日
I have Time in hours in one cell and its minutes in another. How do I combine each minute into respective hour ?? I have to use this time thus obtained to plot against another cell. How to do it ??
  1 件のコメント
Geoff Hayes
Geoff Hayes 2016 年 5 月 17 日
Adarsh - please provide a small sample of the data that you have (from the cells in hours and the cells in minutes) and an example of what you want to obtain.



Todd Leonhardt
Todd Leonhardt 2016 年 5 月 18 日
If you have a cell array with hours in the 1st cell and minutes in the 2nd cell, like so (for 5 hours and 23 minutes):
C = {5 23};
Then you can compute the time in minutes as follows:
time_in_minutes = C{1} * 60 + C{2};
If you wish to populate this overall time in minutes into a 3rd cell, you can do that as follows:
C{3} = time_in_minutes;

その他の回答 (0 件)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by