Main Content

hasNode

Check if node ID exists in factor graph

Since R2022a

Description

example

nodeExist = hasNode(fg,nodeID) checks if a node with the specified node ID exists in the factor graph.

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.

ID of node to check, specified as a nonnegative integer.

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.

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.

Version History

Introduced in R2022a

See Also

Objects