rmlink
Description
Examples
Remove Links Between States in Graph
Load navGraph
object into MATLAB® workspace and inspect its properties.
load("navGraphData.mat")
disp(navGraphObj)
navGraph with properties: States: [8x3 table] Links: [7x3 table] LinkWeightFcn: @nav.algs.distanceEuclidean
Inspect the links table of the input graph.
disp(navGraphObj.Links)
EndStates Weight Curvature _________ ______ _________ 1 3 1.5089 0.0034635 3 7 8.921 0.0063649 5 4 2.387 0.0060558 6 2 19.452 0.0041751 7 1 38.776 0.0051347 7 8 13.938 0.0076324 8 2 43.893 0.0031493
Display the input graph.
show(navGraphObj)
Specify Link Identifiers to Unlink State Pairs
Specify the indices of the state pairs you want to remove from the links table. In this example, you will remove linking between the state pairs defined in the first and third rows of the links table.
rmlink(navGraphObj,[1;3])
Inspect the updated links table for the unlinked state pairs and display the updated graph.
disp(navGraphObj.Links)
EndStates Weight Curvature _________ ______ _________ 3 7 8.921 0.0063649 6 2 19.452 0.0041751 7 1 38.776 0.0051347 7 8 13.938 0.0076324 8 2 43.893 0.0031493
Display the updated graph.
show(navGraphObj)
Specify State Indices to Unlink Multiple State Pairs
Specify the indices of the linked states in the states table that you want to disconnect.
rmlink(navGraphObj,[3 7;6 2;7 1])
Inspect the updated links table for the state pairs that are disconnected.
disp(navGraphObj.Links)
EndStates Weight Curvature _________ ______ _________ 7 8 13.938 0.0076324 8 2 43.893 0.0031493
Display the updated graph.
show(navGraphObj)
Input Arguments
graph
— Graph object
navGraph
object
Graph object, specified as a navGraph
object.
linkIDs
— Link identifiers
column vector of positive integers
Link identifiers, specified as a column vector of positive integers. Link identifiers represent the indices of the state pairs in the links table of the graph.
statePairs
— Indices of states that are connected
two-element column vector | M-by-2 matrix
Indices of the states that are connected, specified as a two-element column vector
or M-by-2 matrix. The indices of the connected states must be taken
from the states table or the links table of the input navGraph
object.
The first column of the links table specify the indices of the connected state pairs.
For example, when you specify statePairs
as [1 3], the function
unlinks the states listed in the first and third rows of the states table of the input
graph.
M specifies the number of connected state pairs to be unlinked.
Data Types: single
| double
| int8
| int16
| int32
| int64
| uint8
| uint16
| uint32
| uint64
| string
| cell
Extended Capabilities
C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.
State indices are not supported as inputs for code generation. Instead, specify link identifiers as inputs.
Version History
Introduced in R2024a
See Also
addstate
| addlink
| rmstate
| findlink
| findstate
| index2state
| state2index
| successors
| show
| copy
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
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
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)