forked from csdms-contrib/topotoolbox
-
Notifications
You must be signed in to change notification settings - Fork 88
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error in computing river bedslope #42
Comments
Dear @carlderas |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello! I am a geologist researcher, who uses the Topotoolbox to automatically delineate and compute river bedslope via knickpoints using data from IfSAR. I have been using the code for a long time, and this the first time I'd encountered such issue when I try computing for river bedslope using the Topotoolbox code.
To compute for river bedslope, first, we sort the attribute data using these codes:
shapefile='C:\Users\USER\Documents\MATLAB\TopoToolbox\knickpoints_filename.shp';
S = shaperead(shapefile);
attributeData = [S.distup];
[sortedData, sortedIndices] = sort(attributeData);
sortedShapefile = S(sortedIndices);
shapewrite(sortedShapefile,'C:\Users\USER\Documents\MATLAB\TopoToolbox\sorted_data_filename.shp');
Then, the difference in slope and elevation values are computed using these codes:
shapefile = 'C:\Users\USER\Documents\MATLAB\TopoToolbox\sorted_data_filename.shp';
S = shaperead(shapefile);
shapefileTable = struct2table(S);
attributeData_dist = shapefileTable.distup;
diff_dist = diff(attributeData_dist);
shapefileTable.diff_dist = [NaN; diff_dist];
attributeData_elev = shapefileTable.elev;
diff_elev = diff(attributeData_elev);
shapefileTable.diff_elev = [NaN; diff_elev];
River bedslope is computed via these next series of codes:
attributeData1 = shapefileTable.diff_elev;
attributeData2 = shapefileTable.diff_dist;
riverbedslope = attributeData1 ./ attributeData2;
shapefileTable.riverbedslope = riverbedslope;
updatedShapefile = table2struct (shapefileTable);
shapewrite(updatedShapefile,'C:\Users\USER\Documents\MATLAB\TopoToolbox\riverbedslope_filename.shp');
Now, when I'm on the part of constructing a table using updatedShapefile = table2struct at the part of computing for river bedslope, I encounter this error:
Not enough input arguments.
Error in table2struct (line 31)
s = cell2struct(table2cell(t),matlab.internal.tabular.makeValidVariableNames(t.Properties.VariableNames,'warn'),2);
Any ideas on how to resolve this error, or why this happens is very much appreciated. Thank you so much.
The text was updated successfully, but these errors were encountered: