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

7 vues (au cours des 30 derniers jours)
anand singh
anand singh le 7 Sep 2019
Commenté : anand singh le 7 Sep 2019
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.

Réponse acceptée

Guillaume
Guillaume le 7 Sep 2019
Modifié(e) : Guillaume le 7 Sep 2019
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)

Plus de réponses (0)

Catégories

En savoir plus sur Tables dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by