rmstate
Description
Examples
Remove States from 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 states table of the input graph.
disp(navGraphObj.States)
StateVector Name Lanes _______________________ _____ _____ 8 2 0.72176 {'A'} 2 1 1 0.29188 {'B'} 2 7 7 0.91777 {'C'} 2 8 10 0.71458 {'D'} 2 5 1 0.54254 {'E'} 2 3 6 0.14217 {'F'} 2 2 9 0.37334 {'G'} 3 8 7 0.67413 {'H'} 2
Display the input graph.
show(navGraphObj)
Specify State Identifiers to Remove States
Specify the indices of the states in the states table that you want to remove from the graph.
rmstate(navGraphObj,[4;5])
Inspect the updated states table for the states that are removed from the graph.
disp(navGraphObj.States)
StateVector Name Lanes _______________________ _____ _____ 8 2 0.72176 {'A'} 2 1 1 0.29188 {'B'} 2 7 7 0.91777 {'C'} 2 3 6 0.14217 {'F'} 2 2 9 0.37334 {'G'} 3 8 7 0.67413 {'H'} 2
Display the updated graph.
show(navGraphObj)
Specify State Names to Remove States
Specify the names of the states you want to remove from the graph.
rmstate(navGraphObj,{"B";"D";"F"})
Inspect the updated states table for the states that are removed from the graph.
disp(navGraphObj.States)
StateVector Name Lanes _______________________ _____ _____ 8 2 0.72176 {'A'} 2 7 7 0.91777 {'C'} 2 2 9 0.37334 {'G'} 3 8 7 0.67413 {'H'} 2
Display the updated graph.
show(navGraphObj)
Input Arguments
graph
— Graph object
navGraph
object
Graph object, specified as a navGraph
object.
stateIDs
— State identifiers
column vector of positive integers
State identifiers, specified as a column vector of positive integers. State identifiers represent the indices of the states in the states table of the input graph.
names
— State names
column vector of strings | column vector of characters | cell array of strings | cell array of characters
State names, specified as a column vector of strings, column vector of characters, cell array of strings, or cell array of characters. The number of rows must be equal to the number of states, and the value of each row must be unique.
Data Types: char
| string
| cell
Extended Capabilities
C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.
For code generation,
Declare states variable in the
States
table of thenavGraph
object as a variable-size data, prior to constructing the table.coder.varsize("states")
State names are not supported.
Version History
Introduced in R2024a
See Also
addstate
| addlink
| rmlink
| findlink
| findstate
| index2state
| state2index
| successors
| show
| copy
Comando MATLAB
Hai fatto clic su un collegamento che corrisponde a questo comando MATLAB:
Esegui il comando inserendolo nella finestra di comando MATLAB. I browser web non supportano i comandi MATLAB.
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)