how to call a variable in single quotation
1 view (last 30 days)
Show older comments
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 Comments
Answers (3)
Jan
on 4 Nov 2011
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 Comments
See Also
Categories
Find more on FTP File Operations 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!