Main Content

hasNode

Check if node ID exists in factor graph

Since R2022a

Description

nodeExist = hasNode(fg,nodeID) checks if the nodes with the specified node IDs exist in the factor graph.

example

Examples

collapse all

Create a factor graph and add a GPS factor to the factor graph connected to node 0.

fg = factorGraph;
id = 0
id = 
0
gps = factorGPS(id);
addFactor(fg,gps);

Check if the factor graph contains node 0.

hasNode(fg,id)
ans = logical
   1

Input Arguments

collapse all

Factor graph, specified as a factorGraph object.

IDs of nodes to check, specified as a nonnegative integer or N-element row or column vector of nonnegative integers. N is the total number of nodes to check.

Output Arguments

collapse all

Node exists in the factor graph, returned as a logical 0 (false) or 1 (true). The function returns 0 if the node does not exist, and 1 if it does exist.

If nodeID is an N-element vector, then nodeExist is returned as an N-element vector of logical values corresponding to each of the specified nodes.

Extended Capabilities

expand all

Version History

Introduced in R2022a

expand all

See Also

Objects