# I need help writing a Matlab script file that creates a temperature conversion chart for conversion from Fahrenheit to Celsius

조회 수: 2 (최근 30일)
Ariana Arvelo 2020년 5월 22일
답변: Rashed Mohammed 2020년 5월 26일
So, I have a homework assignment. I've done most of the coding and I have the result right. But I don't know how to print out the chart to the screen or save it to a file. I can't watch the lesson because my internet isn't good enough so I'm kind of lost.
The prompt is:
Write a Matlab script file that creates a temperature conversion chart for conversion from Fahrenheit to Celsius. The script should prompt the user to input the minimum and maximum temperatures that’ll determine the range of temperatures for the chart in Fahrenheit as well as the number of rows for the char. The script should then print the chart to the standard output and to a file “temperature_conversion.txt”.
And here's what I have so far
prompt = 'Input the minimum degree in Farenheit to convert to Celsius: ';
Fmin = input(prompt);
prompt = '\nInput the maximum degree in Farenheit to convert to Celsius: ';
Fmax = input(prompt);
prompt = 'How many outputs do you want between these two temperatures? ';
rows = input(prompt);
Frange = linspace(Fmin, Fmax, rows);
C= (5/9)*(Frange-32);
I tried something like
fprintf('%d degrees C\n', C);
but it prints out the numbers like '6.349206e-01' and doesn't look like a chart. Any advice on how to do the last two requests?

댓글을 달려면 로그인하십시오.

### 답변 (1개)

Rashed Mohammed 2020년 5월 26일
Hi Ariana,
You can go through https://www.mathworks.com/help/matlab/2-and-3d-plots.html and plot a chart as required from the data you have. For saving the chart to a file you can use the saveas function.
Hope this helps!

댓글을 달려면 로그인하십시오.

### 카테고리

Help CenterFile Exchange에서 Audio and Video Data에 대해 자세히 알아보기

### Community Treasure Hunt

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

Start Hunting!

Translated by