A table variable name subscript must be a character vector
7 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
sydney salvador
am 30 Apr. 2020
Kommentiert: Ameer Hamza
am 1 Mai 2020
What does my error mean? i am trying to upload a ".xls" file using "add button"and transfer the data into a table and "add button" will calculate for stress and strain and plot in UI.axes
% Button pushed function: AddButton
function AddButtonPushed(app, event)
strain = app.StrainEditField.Value;
stress = app.StressEditField.Value;
nr = {strain, stress};
app.UITable.Data = [app.t;nr];
end
% Button pushed function: PlotButton
function PlotButtonPushed(app, event)
app.t = readtable('BlankSheet.xlsx','Sheet',1);
strain = table2array(app.t(:,"")); %A table variable name subscript must be a character vector, string array, or cell array of character vectors.
stress = table2array(app.t(:,""));
plot(app.UIAxes,strain,stress);
end
end
0 Kommentare
Akzeptierte Antwort
Ameer Hamza
am 30 Apr. 2020
You need to write the name of column
strain = table2array(app.t(:,"strain_column_name")); %A table variable name subscript must be a character vector, string array, or cell array of character vectors.
stress = table2array(app.t(:,"stress_column_name"));
Also, you can avoid table2array to array by using brace indexing
strain = app.t{:,"strain_column_name"}; %A table variable name subscript must be a character vector, string array, or cell array of character vectors.
stress = app.t{:,"stress_column_name"};
4 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Stress and Strain finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!