diff operation generating error Subscript indices must either be real positive integers or logicals

I have a time vector which I have attached in a .mat file.
diff(time) generates the following error: Subscript indices must either be real positive integers or logicals.
time is a vector, it does not contain values to be interpreted as indices. Why is this occurring & how can I correct it?

 採用された回答

Matt J
Matt J 2017 年 2 月 16 日
編集済み: Matt J 2017 年 2 月 16 日
You have a variable named "diff" somewhere in your workspace. MATLAB is interpreting diff(time) as an attempt to index it.
Solution: clear it or rename it to something else.

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeSimulink についてさらに検索

製品

質問済み:

2017 年 2 月 16 日

コメント済み:

2017 年 2 月 16 日

Community Treasure Hunt

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

Start Hunting!

Translated by