MATLAB Answers

how to convert the mutiple colum into single colum using colon :

1 view (last 30 days)
the table given above is the three column represent hour minute second in separate column i want to combine into single column separated by colon(:) given below format
output:
0:0:0.0180
0:0:0.0380
0:0:0.0580
0:0:0.0780
0:0:0.0980
0:0:0.1180
0:0:0.1380
0:0:0.1580
0:0:0.1780

  0 Comments

Sign in to comment.

Accepted Answer

Walter Roberson
Walter Roberson on 28 Jan 2020
duration(YourData(:,4), YourData(:,5), YourData(:,6), 'format', 'hh:mm:ss.SSSS')

  8 Comments

Show 5 older comments
MONICA RAWAT
MONICA RAWAT on 22 Feb 2020
duration(YourData(:,4), YourData(:,5), YourData(:,6), 'format', 'hh:mm:ss.SSSS')
my time is in UTC i wanted to converted to IST by adding +5:30 to my UTC time so with the output mention above in question how can i add +5:30 to my output data ,because the code you have provided is correct but unable to convert to IST because this is duration not a numeric matric
Walter Roberson
Walter Roberson on 22 Feb 2020
IST_Duration = UTC_Duration + hours(5) + minutes(30)
However, it makes no sense to do so. Durations are for elapsed time relative to some starting point. TimeZone corrections only make sense relative to a date. If you have a date as well as a time of day then you would put everything together using datetime() instead of duration(). At the time you use datetime() you would use the option 'TimeZone', 'UTC' . Then once you had the resulting datetime object, you would set the TimeZone property of it to 'Asia/Calcutta' .

Sign in to comment.

More Answers (1)

Selva Karna
Selva Karna on 28 Jan 2020
clc
clear all;
close all;
data=your_data;
con_singl_col=data(:);

  0 Comments

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!