datestring in uitable problem with cells array

조회 수: 1 (최근 30일)
EanX
EanX 2013년 2월 20일
I want to display a cell array in uitable, if I define, for example
c={'01-Feb-2008' 458;'08-Jun-2009' 5}
then
uitable('Data',c) it works correctly
while if I have something like this
c={cellstr(datestr(data_between_dates(1:2,1),'dd-mm-yyyy')) ,data_between_dates(1:2,2)}
where data_between_dates has a first column of datenum but I want to display date strings, then I get the following error:
Error using uitable Values within a cell array must be numeric, logical, or char
Error in uitable (line 52) thandle = builtin('uitable', varargin{:});
What's wrong? Thanks.
  댓글 수: 2
Azzi Abdelmalek
Azzi Abdelmalek 2013년 2월 20일
What is data_between_dates?
EanX
EanX 2013년 2월 20일
편집: EanX 2013년 2월 20일
Is a matrix of 4 columns with datenum as first column (below first three rows):
733529,246527778 101 17 229
733529,250000000 114 17 229
733529,253472222 126 18 229

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

채택된 답변

Azzi Abdelmalek
Azzi Abdelmalek 2013년 2월 20일
편집: Azzi Abdelmalek 2013년 2월 20일
Use
dates=cellstr(datestr(data_between_dates(1:2,1),'dd-mm-yyyy'))
data=num2cell(data_between_dates(1:2,2))
c=[dates data]

추가 답변 (1개)

Jan
Jan 2013년 2월 20일
c = {cellstr(...
This creates a cell, whose first element is a cell string, not a string, like:
c = {{'string'}, ...}
But UITABLE can handle strings only.

카테고리

Help CenterFile Exchange에서 Dates and Time에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by