2.2.4.28.32 MatrixObject::IsVirtual

Description

To check if the matrix object is a virtual matrix.

Syntax

BOOL IsVirtual(DataRange* pRange = NULL)

Parameters

pRange
[output]the pointer of XYZ data range in Worksheet.

Return

returns true if the matrix object is a virtual matrix, else false.

Examples

EX1

1. Copy the following data and paste into an empty Worksheet.

5 10 15
1 10 4 4
2 15 8 12
3 30 6 10

2. Select the whole Worksheet and run the following command to create a virtual matrix named "vm1".

w2vm format:=xacross rowpos:=selrow1 colpos:=wkscol1 vmname:=vm1;

3. Run the following sample function.

int MatrixObject_IsVirtual_ex1()
{
	MatrixObject matObj;	
	matObj.Attach("vm1"); // attach to virtual matrix by name

	// matObj should be virtual matrix
	DataRange dr;
	if( matObj && matObj.IsVirtual(&dr) )
	{
		out_str("matObj is Virtual Matrix.");
		
		// convert range to tree and output
		Tree tr;
		dr.GetTree(tr, false);		
		out_tree(tr);
	}
	
	MatrixPage matPage;
	matPage.Create("Origin");
	MatrixLayer ml = matPage.Layers(0);
	MatrixObject matObj2 = ml.MatrixObjects(0);
	
	// matObj2 should not be virtual matrix
	if( matObj2 && !matObj2.IsVirtual() )
	{
		out_str("matObj2 is NOT Virtual Matrix.");
	}
	return 1;
}

Remark

See Also

Header to Include

origin.h