How to display value of diff 0

2 ビュー (過去 30 日間)
Mohammed Shadab Khan
Mohammed Shadab Khan 2022 年 11 月 13 日
回答済み: Image Analyst 2022 年 11 月 13 日
I have code ready but I am not able to make a table because the array lengths are different as there is diff of zero in the first value Matlab is just skipping to next and instead of me getting an answer with 32 elements i am getting the anwer with 31 elements.
  1 件のコメント
Torsten
Torsten 2022 年 11 月 13 日
Then skip one element of the second vector or add one element to the first vector.

サインインしてコメントする。

回答 (1 件)

Image Analyst
Image Analyst 2022 年 11 月 13 日
If v is your vector and d is the difference vector and you want them to be the same size, a common solution is
d = [0, diff(v)]; % If v is a row vector.
d = [0; diff(v)]; % If v is a column vector.

カテゴリ

Help Center および File ExchangeLogical についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by