行列の値
Namespace: FVIL.DataAssembly: FVILbasic (in FVILbasic.dll) Version: 3.1.0.0 (3.1.0.17)
Syntax
C# |
---|
public virtual double this[ int row, int col ] { get; set; } |
Visual Basic |
---|
Public Overridable Default Property Item ( row As Integer, col As Integer ) As Double Get Set |
Parameters
- row
- Type: System..::..Int32
行位置 (0~)
- col
- Type: System..::..Int32
列位置 (0~)
Return Value
Type: Double指定位置の要素を返します。
Remarks
行列の要素の取得または設定を行います。 row は 0~(Rows-1) の範囲で指定し、 col は 0~(Columns-1) の範囲で指定してください。
取得または設定に失敗した場合は例外を発行します。 例外の原因と発生位置を特定するには、発行された例外クラスの ErrorCode メンバと Function メンバを参照してください。
エラーコード:
値 | ErrorCode メンバ | 内容 |
---|---|---|
11 | FVIL.ErrorCode.INVALID_PARAMETER | 指定された指標が不正です。 |
Examples
ソースコード:
【関数の出力】
C# | Copy |
---|---|
// $Revision: 1.2 $ using System; using System.Collections.Generic; using System.Text; using fvalgcli; // FvPluginXXXX attribute requires fvalgcli namespace User.SampleCode { public partial class Matrix { /// <summary> /// 行列の要素の取得および設定. /// </summary> [FvPluginExecute] public void Property_Item() { int rows = 4; int columns = 3; // 1) インスタンスの準備. FVIL.Data.CFviMatrix mat = new FVIL.Data.CFviMatrix(rows, columns); // 設定. mat[0, 0] = 0.0; mat[0, 1] = 0.1; mat[0, 2] = 0.2; mat[1, 0] = 1.0; mat[1, 1] = 1.1; mat[1, 2] = 1.2; mat[2, 0] = 2.0; mat[2, 1] = 2.1; mat[2, 2] = 2.2; mat[3, 0] = 3.0; mat[3, 1] = 3.1; mat[3, 2] = 3.2; // 取得. for(int r=0 ; r<mat.Rows ; r++) for(int c=0 ; c<mat.Columns ; c++) Console.Write("[{0},{1}]={2} ", r, c, mat[r,c]); Console.WriteLine(""); Console.WriteLine("Rows={0}", mat.Rows); Console.WriteLine("Columns={0}", mat.Columns); Console.WriteLine("Size={0}", mat.Size.ToString()); } } } |
Visual Basic | Copy |
---|---|
' $Revision: 1.1 $ Imports System.Collections.Generic Imports System.Text Imports fvalgcli ' FvPluginXXXX attribute requires fvalgcli Namespace SampleCode Public Partial Class Matrix ''' <summary> ''' 行列の要素の取得および設定. ''' </summary> <FvPluginExecute> _ Public Sub Property_Item() Dim rows As Integer = 4 Dim columns As Integer = 3 ' 1) インスタンスの準備. Dim mat As New FVIL.Data.CFviMatrix(rows, columns) ' 設定. mat(0, 0) = 0.0 mat(0, 1) = 0.1 mat(0, 2) = 0.2 mat(1, 0) = 1.0 mat(1, 1) = 1.1 mat(1, 2) = 1.2 mat(2, 0) = 2.0 mat(2, 1) = 2.1 mat(2, 2) = 2.2 mat(3, 0) = 3.0 mat(3, 1) = 3.1 mat(3, 2) = 3.2 ' 取得. For r As Integer = 0 To mat.Rows - 1 For c As Integer = 0 To mat.Columns - 1 Console.Write("[{0},{1}]={2} ", r, c, mat(r, c)) Next Next Console.WriteLine("") Console.WriteLine("Rows={0}", mat.Rows) Console.WriteLine("Columns={0}", mat.Columns) Console.WriteLine("Size={0}", mat.Size.ToString()) End Sub End Class End Namespace |
[0,0]=0 [0,1]=0.1 [0,2]=0.2 [1,0]=1 [1,1]=1.1 [1,2]=1.2 [2,0]=2 [2,1]=2.1 [2,2]=2.2 [3,0]=3 [3,1]=3.1 [3,2]=3.2 Rows=4 Columns=3 Size={Width=3, Height=4}
Exceptions
Exception | Condition |
---|---|
FVIL..::..CFviException | この例外の原因については、上記のエラーコード表をご参照ください。 |