write a script which will print a table on screen of the temperature in celsius and the corresponding temperature in fahrenheit from 0 to 100 in steps of 5 in matlab

main.m
% Define the celsius temperatures (0 to 100 in steps of 5)
celsius_temperatures = 0:5:100;

% Convert the celsius temperatures to fahrenheit
fahrenheit_temperatures = (celsius_temperatures * (9/5)) + 32;

% Create a table to display the celsius and corresponding fahrenheit temperatures
temperature_table = table(celsius_temperatures', fahrenheit_temperatures', 'VariableNames', {'Celsius', 'Fahrenheit'});

% Display the table in the command window
disp(temperature_table);
475 chars
12 lines

This script defines an array of celsius temperatures from 0 to 100 in steps of 5. It then converts these temperatures to fahrenheit using the standard formula. A table is created from the two temperature arrays using the "table" function, with "VariableNames" used to specify column headings. The resulting table is then displayed in the MATLAB command window using the "disp" function.

gistlibby LogSnag