Undefined function 'diff' for input arguments of type 'table'

9 次查看(过去 30 天)
Dear Members,
I am facing following error when running my MATLAB code. Please advice the solution for this.
>> ind1=find( diff(daily_stk(:,2)) ~= 0 ); % row number
Undefined function 'diff' for input arguments of type 'table'.
daily_stk.Properties
ans =
TableProperties with properties:
Description : ''
UserData : []
DimensionNames : {'Row' 'Variables'}
VariableNames : {'yyyy' 'mm' 'dd' 'vwretd'}
VariableDescriptions : {}
VariableUnits : {}
VariableContinuity : []
RowNames : {}
CustomProperties : No custom properties are set.
Use addprop and rmprop to modify CustomProperties.

采纳的回答

Guillaume
Guillaume 2019-9-7
编辑:Guillaume 2019-9-7
As I've told you already, read the documentation, in particular Access data in tables.
As explained on that page, () indexing returns a table. You want the content of the table which you can access with
daily_stk{:, 2}
or
daily_stk.(2)
or better
daily_stk.mm
so,
rowindex = find(diff(daily_stk.mm) ~= 0)

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Tables 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by