フィルターのクリア

Generating scalars from Approximate values

1 回表示 (過去 30 日間)
Ben
Ben 2011 年 4 月 14 日
Hi, I would like Matlab to generate two scalars whose values are equal to the corresponding values of the first and last column of the matrix when columns 2:5 are approximate to another 1x4 vector.
That's to say.. whenever columns two through five are (as closely as possible) approximate to the 1x4vector, then I want the two scalars to be generated.
--Thankful and Humbled
  2 件のコメント
Matt Tearle
Matt Tearle 2011 年 4 月 14 日
can you please show a small, simple example to explain what you want? thanks
Walter Roberson
Walter Roberson 2011 年 4 月 14 日
If the columns 2 through 5 are not closely enough approximate to the 1x4 vector, then what should be the output result for that row?

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

回答 (1 件)

Matt Fig
Matt Fig 2011 年 4 月 14 日
Is your matrix actually a row vector? I hope so, or you will have to clarify how an n-by-4 array is to approximate a 1-by-4 vector.
Even if your array is a row vector, what kind of approximations is it that you need? Is three matching values, no matter how large the difference between the fourth values, a good match? Is it the magnitudes that must be within a tolerance? You need to be more specific...
if (matching condition)
sc1 = arr(1);
sc2 = arr(6);
end

カテゴリ

Help Center および File ExchangeMatrices and Arrays についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by