필터 지우기
필터 지우기

How to let Matlab fill in different date, string, and numbers in a table

조회 수: 3 (최근 30일)
alpedhuez
alpedhuez 2020년 12월 10일
편집: Walter Roberson 2020년 12월 11일
Suppose I have table T1
Date City Vistors
------------------
January 1 2020 NY 100
January 2 2020 NY 110
and table T2
Date City Vistors
------------------
January 4 2020 NY 130
January 5 2020 NY 140
Then I want to have
Date City Vistors
------------------
January 1 2020 NY 100
January 2 2020 NY 110
January 3 2020 NY 120
January 4 2020 NY 130
January 5 2020 NY 140
That is,
(1) I want to vertcat(T1,T2)
(2) Fill in missing date
(3) Fill in missing value for state with the same state name
(4) Fill in missing value for vistors with linear interporation
  댓글 수: 10
Adam Danz
Adam Danz 2020년 12월 11일
Maybe you could show us what you're trying to compare.
To summarize our suggestions so far,
  1. Vertically concatenate the tables assuming they have the same number of columns and same variable names (T=[T1;T2])
  2. Convert the City names from string to categorical (see categorical as dpb showed you)
Then you have 2 options,
  1. Use fillmissing , or
  2. Convert the table to timetable if it isn't already (see table2timetable) and use retime.
If you're stuck at one of those steps or one of these steps won't work with your data, please explain.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Timetables에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by