How do I download several .txt files to the same directory?

3 views (last 30 days)
I am trying to make a program my professor wrote about stellar spectra work. To do so she says I need to download several text files to the same directory. I am very confused about how to do so. This is the beginning of the program:
clear
load(O5V.txt)
load(B3V.txt)
load(A0.txt)
load(F0.txt)
load(G0.txt)
load(K0.txt)
load(M0.txt)

Answers (2)

Image Analyst
Image Analyst on 23 Feb 2014
What does "download several text files to the same directory" mean? Do you mean that they exist on the server or a web site and you need to download them to a folder on your local computer's hard drive? Your code does not do that. Your code takes files on the search path and loads them into the workspace memory of your m-file, that is if you fixed it by enclosing your filenames in single quotes. This is totally different. I don't know what you intend to do since your code and question are two different things.

Hannah
Hannah on 23 Feb 2014
Exactly, I am horribly confused because I don't know what she means by that either. I downloaded the files from a website to a folder on my computer's hard drive, the same folder I have my .m file saved in. That is only part of the code, the rest is codes for plotting and I didn't think it was relevant, but I'll post it anyway.
lamO5V=O5V(:,1);
fluxO5V=O5V(:,2);
lamB3V=B3V(:,1);
fluxB3V=B3V(:,2);
lamA0=A0(:,1);
fluxA0=A0(:,2);
lamF0=F0(:,1);
fluxF0=F0(:,2);
lamG0=G0(:,1);
fluxG0=G0(:,2);
lamK0=K0(:,1);
fluxK0=K0(:,2);
lamM0=M0(:,1);
fluxM0=M0(:,2);
%plotting figure(1) clf(1) plot(lamO5V,log10(fluxO5V),'Color',[.5 .5 .5],'LineWidth',3) hold on plot(lamB3V,log10(fluxB3V),'b','LineWidth',2) plot(lamA0,log10(fluxA0),'k','LineWidth',2) plot(lamF0,log10(fluxF0),'r','LineWidth',2) plot(lamG0,log10(fluxG0),'c','LineWidth',2) plot(lamK0,log10(fluxK0),'g','LineWidth',2) plot(lamM0,log10(fluxM0),'m','LineWidth',2) legend('O5','B3','AO','F0','G0','K0','M0') xlabel('Lambda (nm)','fontsize',18, 'FontWeight','bold') title('Spectral Types','fontsize',18, 'FontWeight','bold')
figure(2) clf(2) plot(lamO5V,log10(fluxO5V.*5),'Color',[.5 .5 .5],'LineWidth',3) hold on plot(lamB3V,log10(fluxB3V),'b','LineWidth',2) plot(lamA0,log10(fluxA0./10),'k','LineWidth',2) plot(lamF0,log10(fluxF0./100),'r','LineWidth',2) plot(lamG0,log10(fluxG0./1000),'c','LineWidth',2) plot(lamK0,log10(fluxK0./10000),'g','LineWidth',2) plot(lamM0,log10(fluxM0./1000000),'m','LineWidth',2) legend('O5','B3','AO','F0','G0','K0','M0') xlabel('Lambda (nm)','fontsize',18, 'FontWeight','bold') title('Spectral Types','fontsize',18, 'FontWeight','bold')

Categories

Find more on Downloads in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!