Filter löschen
Filter löschen


Diese Frage ist geschlossen. Öffnen Sie sie erneut, um sie zu bearbeiten oder zu beantworten.

Can anyone help me with telling me how my variable is undefined?

1 Ansicht (letzte 30 Tage)
dbh0031 am 23 Okt. 2015
Geschlossen: MATLAB Answer Bot am 20 Aug. 2021
Its telling me my variable for temperature is undefined when i clearly define it in line 8. Any thoughts?

Antworten (1)

Ken Atwell
Ken Atwell am 23 Okt. 2015
You are writing a function that accepts 'temperature' as an input parameter. So, 'temperature' will exist inside your functions, assuming you pass in an argument to your function. 'temperature' is not declared on line 8, the existing values (line 1) is being overwritten.
That is all inside your function. Outside your function, working in the Command Window, 'temperature' will not exist unless you create it. Were you provided a set of test data? If so, you need to load that in and pass it to 'sortTemps', something like:
>> myData = ...;
>> newData = sortTemps(myData);

Diese Frage ist geschlossen.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by