creating vector from text file

28 ビュー (過去 30 日間)
Zack Bayhan
Zack Bayhan 2014 年 12 月 10 日
コメント済み: Star Strider 2014 年 12 月 10 日
Hey guys, Can anyone tell me why this isn't working out? I'm trying to create a vector from reading a text file in my working directory and it isn't work out? I've tried a few things but so far nothing has worked. So what I have is a text file, which was recently downloaded and placed in my directory. I would like to get something like this Input:
symbols=textread('S&P-500-symbols.txt','n')
Output:
symbols={'NLY', 'CSCO', 'RAI','F','GM','HGT','GOOGL','TSLA',....etc};
The Output is in a form that works with another section of code that is currently working so If I can read the text document and get the code in that form I would be in great shape to use the two together. Thanks Zack

採用された回答

Star Strider
Star Strider 2014 年 12 月 10 日
You forgot to tell it what format descriptor to use:
symbols=textread('S&P-500-symbols.txt','%s');
produces a (500x1) cell of them.
  2 件のコメント
Zack Bayhan
Zack Bayhan 2014 年 12 月 10 日
Thanks for the help again Star Strider!
Star Strider
Star Strider 2014 年 12 月 10 日
As always, my pleasure!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeStartup and Shutdown についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by