Why do I get this error and is it something to do with my code?
Show older comments
I get this error when I try to run my code
code:
% a.) column vector of last names called last, using curly braces.
last={'Smith'; 'Jones'; 'Webb'; 'Anderson'}
% b.) column vector of first names called first, usinf curly braces.
first={'Fred'; 'Kathy'; 'Milton'; 'John'}
% c.) column vectors for age, height and weight.
age=[6; 22; 92; 45]
Height=[47; 66; 62; 72]
weight=[82; 140; 110; 190]
% d.) display information using the 'table' function.
table(last,first,age,Height,weight)
error:
Warning: Error occurred while executing the listener callback for event POST_REGION defined for class matlab.internal.language.RegionEvaluator:
Undefined function 'power' for input arguments of type 'table'.
)
h=(-(9.8/2).*t.^2)+(125.*t)+500;
tHeight = height(obj);
Error in matlab.internal.editor.VariableOutputPackager.isolatedDisplaying
Error in matlab.internal.editor.VariableOutputPackager.getStringFromVar
Error in matlab.internal.editor.VariableOutputPackager.getTruncatedStringFromVar
Error in matlab.internal.editor.interactiveVariables.InteractiveTabularUtils.getTruncatedStringFromTable
Error in matlab.internal.editor.interactiveVariables.InteractiveTablesPackager.packageVarTable
Error in matlab.internal.editor.interactiveVariables.InteractiveVariablesPackager.packageVarInteractive
Error in matlab.internal.editor.VariableOutputPackager.packageOutput
2 Comments
If you run as such the lines, it should work:
% a.) column vector of last names called last, using curly braces.
last={'Smith'; 'Jones'; 'Webb'; 'Anderson'}
% b.) column vector of first names called first, usinf curly braces.
first={'Fred'; 'Kathy'; 'Milton'; 'John'}
% c.) column vectors for age, height and weight.
age=[6; 22; 92; 45]
Height=[47; 66; 62; 72]
weight=[82; 140; 110; 190]
% d.) display information using the 'table' function.
table(last,first,age,Height,weight)
It seems you are calling it in a gui...so the error says variable power is not defined. Error might be with someother lines then you mentioned.
Luca Ferro
on 16 Jan 2023
it runs correctly without any change on my machine as well
Answers (1)
Walter Roberson
on 16 Jan 2023
0 votes
you created your own height.m that is interfering with the Mathworks height function
Categories
Find more on MATLAB Compiler in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!