How do I import the data correctly for it to accept it?

1 view (last 30 days)
This what I have so far but it keeps giving me a error.
clear;
clc;
close all
load AVG_Temp.txt
% 1st line is data of Philly
Philly=AVG_Temp(1,:);
% 2nd line is data of Raleigh
Raleigh=AVG_Temp(2,:);
% 3rd line is data of Fresno
Fresno=AVG_Temp(3,:);
% plot-1
subplot(1,3,1)
plot(1:length(Philly),Philly,'--d')
xlabel('Month')
ylabel('Avg. Temperature')
title('Philly')
axis([1 12 30 105])
% plot-2
subplot(1,3,2)
plot(1:length(Raleigh),Raleigh,'--d')
xlabel('Month')
ylabel('Avg. Temperature')
title('Raleigh')
axis([1 12 30 105])
% plot-3
subplot(1,3,3)
plot(1:length(Fresno),Fresno,'--d')
xlabel('Month')
ylabel('Avg. Temperature')
title('Fresno')
axis([1 12 30 105])
Error using load
Unknown text on line number 1 of ASCII file AVG_Temp.txt
"Philly".
Error in ME02_Baluch_Assign9 (line 50)
load AVG_Temp.txt
  2 Comments
Rik
Rik on 17 Nov 2020
The key search term is already in your question title. Did you google how to import data from a text file? Can you attach your text file (you can edit your question and use the paperclip icon to attach it).
Did you use the debugger to step through your code line by line? What happens when you reach the line with load?
A
A on 17 Nov 2020
I did do that but I couldn't figure out where i was so post to download the file to.
If I use the debugger it tell me this.
Error using load
Unknown text on line number 1 of ASCII file AVG_Temp.txt
"Philly".

Sign in to comment.

Answers (1)

Cris LaPierre
Cris LaPierre on 18 Nov 2020
I'd suggest looking into how to load data from a text file.

Community Treasure Hunt

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

Start Hunting!