ドキュメンテーション
最新のリリースでは、このページがまだ翻訳されていません。 このページの最新版は英語でご覧になれます。
値が非スパースであることを検証し、そうでない場合はエラーを発行
mustBeNonsparse(A)
例
mustBeNonsparse(A) は、A がスパースである場合にエラーを発行します。この関数は値を返しません。
A
オブジェクトのクラスが次のメソッドを実装する場合、mustBeNonsparse はユーザー定義オブジェクトを受け入れます。
mustBeNonsparse
issparse
すべて折りたたむ
mustBeNonsparse を使用して、入力が非スパースであることを検証します。
スパース行列の作成には関数 sparse を使用します。
sparse
A = [ 0 0 0 5 0 2 0 0 1 3 0 0 0 0 4 0]; S = sparse(A);
S が非スパースであることを検証します。
S
mustBeNonsparse(S)
Error using mustBeNonsparse (line 13) Values must not be sparse.
このクラスは Prop1 の値を非スパース値に制約します。
Prop1
classdef MyClass properties Prop1 {mustBeNonsparse} end end
オブジェクトを作成して、プロパティに値を割り当てます。
obj = MyClass; A = [ 0 0 0 5 0 2 0 0 1 3 0 0 0 0 4 0]; obj.Prop1 = sparse(A);
Error setting 'Prop1' property of 'MyClass' class: Values must not be sparse.
プロパティに値を割り当てると、MATLAB® はプロパティに割り当てた値を使用して mustBeNonsparse を呼び出します。Prop1 に割り当てられた値がスパースであるため、mustBeNonsparse はエラーを発行します。
検証する値。スカラーまたは次のいずれかの配列として指定します。
logical または数値クラス
logical
issparse を実装する MATLAB クラス
データ型: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64 | logical | char 複素数のサポート: あり
single
double
int8
int16
int32
int64
uint8
uint16
uint32
uint64
char
mustBeNonempty | mustBeNumeric
mustBeNonempty
mustBeNumeric
MATLAB のコマンドを実行するリンクがクリックされました。
このリンクは、Web ブラウザーでは動作しません。MATLAB コマンド ウィンドウに以下を入力すると、このコマンドを実行できます。
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Contact your local office