ascii
FTP 전송 모드를 ASCII로 설정
설명
예제
전송 모드를 ASCII로 설정하기
ASCII 전송 모드를 사용하여 FTP 서버에서 텍스트 파일을 다운로드합니다.
먼저, NCEI(National Centers for Environmental Information) FTP 서버에 연결합니다.
ftpobj = ftp('ftp.ngdc.noaa.gov')
FTP with properties: Host: "ftp.ngdc.noaa.gov" Username: "anonymous" Port: 21 ServerLocale: "en_US" DirParserFcn: @matlab.io.ftp.parseDirListingForUnix Mode: "binary" LocalDataConnectionMethod: "passive" RemoteWorkingDirectory: "/"
기본 전송 모드는 이진입니다. 텍스트 파일을 다운로드할 경우, 새 줄 문자가 올바르게 변환되도록 ASCII 모드를 대신 사용할 수 있습니다.
전송 모드를 ASCII로 설정합니다. 현재 전송 모드를 보려면 FTP 객체를 표시하십시오.
ascii(ftpobj) ftpobj
FTP with properties: Host: "ftp.ngdc.noaa.gov" Username: "anonymous" Port: 21 ServerLocale: "en_US" DirParserFcn: @matlab.io.ftp.parseDirListingForUnix Mode: "ascii" LocalDataConnectionMethod: "passive" RemoteWorkingDirectory: "/"
텍스트 파일을 다운로드하고 연결을 닫습니다.
mget(ftpobj,'README.txt');
close(ftpobj)
README.txt
의 시작 부분을 표시합니다. 컴퓨터에 다운로드한 README.txt
의 복사본을 읽으려면 fileread
함수를 사용하십시오.
readme = fileread('README.txt');
readme(1:95)
ans = ' Welcome to the NOAA/National Centers for Environmental Information (NCEI)'
NCEI(National Centers for Environmental Information)에서 제공하는 FTP 서비스입니다. NCEI 서비스 약관을 보려면 NCEI Privacy Policy, Disclaimer, and Copyright를 참조하십시오.
입력 인수
ftpobj
— FTP 서버와의 연결
FTP 객체
FTP 서버와의 연결로, FTP 객체로 지정됩니다.
버전 내역
R2006a 이전에 개발됨
MATLAB 명령
다음 MATLAB 명령에 해당하는 링크를 클릭했습니다.
명령을 실행하려면 MATLAB 명령 창에 입력하십시오. 웹 브라우저는 MATLAB 명령을 지원하지 않습니다.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)