need help making a table not a graph and naming the columns.

4 Ansichten (letzte 30 Tage)
evan melanson
evan melanson am 22 Nov. 2021
Kommentiert: Steven Lord am 22 Nov. 2021
i got a graph to show but i need to make a table for my homework i am looking for some help. the columns names are Celsius and Fahrenheit.
this is my code so far.
C=-50:10:150;
F=(C*(9/5))+32;
fprintf('HW #6 - Evan Melanson \n\n');
fprintf('Problem 1 \n\n');
oC=C';
oF=F';
fprintf('degree Celsius and Fahrenheit table\n');
oC=round(oC,3);
oF=round(oF,3);
plot(oC,oF)
xlabel('Celsius')
ylabel('Fahrenheit')
  2 Kommentare
Patrick Bruijnes
Patrick Bruijnes am 22 Nov. 2021
If you add the following line you will get a 2x21 double in the workspace called 'table'. This should be the table you are looking for?
table = [oC, oF]'
Steven Lord
Steven Lord am 22 Nov. 2021
Instead of defining a variable named table that prevents you from using the MATLAB function table I would store the data in a table array:
C=(-50:10:150).';
F=(C*(9/5))+32;
t = table(C, F, 'VariableNames', ["Celsius", "Fahrenheit"]);
head(t) % only display the first few rows
ans = 8×2 table
Celcius Fahrenheit _______ __________ -50 -58 -40 -40 -30 -22 -20 -4 -10 14 0 32 10 50 20 68

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Kategorien

Mehr zu Tables finden Sie in Help Center und File Exchange

Tags

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by