how to call a variable in single quotation
조회 수: 1 (최근 30일)
이전 댓글 표시
I am trying to download files from an ftp server using the command mget.
I am reading the location from an excell file and assign them to a variable. For Example d is a vector containing the locations. d=[ web/dr.txt, web/dr1.txt] in order to download them using mget I need mget(ftp, 'web/dr.txt').
But if I don't use the single quotes it will not get it. I want to call mget(ftp, d(1)) for example. But I want the text assigned to d(1) to appear in mget with single quotes. How can I do it?
Can anyone help me please?
댓글 수: 0
답변 (3개)
Jan
2011년 11월 4일
No, you do not want the quotes to appear in the mget command. The quotes are displayed in the command window, when a cell string is printed. And the quotes are used to define a string in the source code. But the quotes are not part of the string.
Walter's example works, if you consider the curly braces. Using round parenthesis calls mqet with a scalar cell string, but you need the contents of the first element of this cell string:
d = {'web/dr.txt' 'web/drt1.txt'};
class(d(1)) % >> cell
class(d{1}) % >> char
Please read the Getting Started chapters of the documentation. Cell strings are explained there exhaustively.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 FTP File Operations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!