How to write a function that performs the same as the build-in function isequal?

4 ビュー (過去 30 日間)
Pawel Kaszynski
Pawel Kaszynski 2022 年 2 月 20 日
コメント済み: Stephen23 2022 年 2 月 21 日
How to write a function that performs the same as the build-in function isequal?

回答 (1 件)

Image Analyst
Image Analyst 2022 年 2 月 20 日
function theSame = myEqual(ver1, var2)
theSame = isequal(var1, var2);
If that's not acceptable then you'd have to write cases for all kinds of variables. You'd have to check the variable type of each, and if they're not the same, immediately return false. If they are the same, like they're both matrices you'd have to check things like the number of elements or number of rows and columns.
  1 件のコメント
Stephen23
Stephen23 2022 年 2 月 21 日
Also it will likely require some recursive local function to handle container types.

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

カテゴリ

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

製品


リリース

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by