フィルターのクリア

import images with timestamps label

6 ビュー (過去 30 日間)
ennes mulla
ennes mulla 2021 年 7 月 7 日
コメント済み: Peter Perkins 2021 年 7 月 27 日
Hi
I have images that have timestamp label, I want only to import only the timestamp and store in one colmun array without loading all images to spacework.
The images labeling has the follwing Shape: yyyy-mm-dd:HH:MM:ss.jpg
for instance 2021-07-05-14:17:05.jpg
Many thanks in advance
  3 件のコメント
ennes mulla
ennes mulla 2021 年 7 月 7 日
Thank you. I have used the following code and i could store the name of images in an array and then convert it into datenum and return into datetime so I could plot it against another set of data I had and now it works as i wanted it to be
S = dir(fullfile(directory,'*.jpg'));
N = {S.name};
N = erase(N,".jpg")
N = transpose (N)
N = strrep (N,'_',':')
fmt ='yyyy-mm-dd-HH:MM:SS';
DateString = datestr(N,fmt);
DateString = datenum(DateString);
DateString = transpose(DateString);
HistoryJune24th = datetime(DateString,'ConvertFrom','datenum')
Peter Perkins
Peter Perkins 2021 年 7 月 27 日
DateString = datestr(N,fmt);
DateString = datenum(DateString);
DateString = transpose(DateString);
HistoryJune24th = datetime(DateString,'ConvertFrom','datenum')
seems very round-about. Can't say this strngly enough: Don't use datestr and datenum. If this is still part of your code, I suggest
HistoryJune24th = datetime(N,"Format",'yyyy-MM-dd-HH:mm:ss')

サインインしてコメントする。

採用された回答

Jonas
Jonas 2021 年 7 月 7 日
編集済み: Jonas 2021 年 7 月 7 日
this stores all file names without the '.jpg' ending in the cell array 'names'
names=erase({dir('my/path/to/images/*.jpg').name},'.jpg');
  1 件のコメント
ennes mulla
ennes mulla 2021 年 7 月 8 日
thanks man ... it worked

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeTime Series Objects についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by