Identify all upstream nodes or linkages
Version 1.0.0 (2.04 KB) by
Jeff Burkey
findUpstream - is a recursive function that traces upstream using a provided table of linkages
findUpstream - is a recursive function that traces upstream using a provided table of linkages (upstream, downstream).
Essentially, this script simply uses Matlab's 'ismember' function. I'm not sure if this script is even worthy to post, but since I had to write, it, I'm sharing it (for what it's worth).
This function will identify all catchments connected upstream of a given catchment based on a provided routing network. There can be any number of branches and the recursion will work through all of them.
The concept is based on node or link structure that is in two columns, upstream in first column and downstream in second column. User inputs a node of interest, and the 'ismember' loops through working it's way upstream, which, BTW, can handle unlimited number of branches.
The commands used in this function are targeting numeric variable types within a 'table' datatype.
T is a table with at least two variables with the names:
Upstream, Downstream
c is a catchment ID that will be used to find all upstream catchments.
The variable types must match between the two variables in table T and the variable c.
written by Jeff Burkey, King County Department of Natural Resources
December 20, 2024.
Cite As
Jeff Burkey (2025). Identify all upstream nodes or linkages (https://www.mathworks.com/matlabcentral/fileexchange/177909-identify-all-upstream-nodes-or-linkages), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Created with
R2024b
Compatible with any release
Platform Compatibility
Windows macOS LinuxTags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.
Version | Published | Release Notes | |
---|---|---|---|
1.0.0 |