フィルターのクリア

How to plot a candlestick chart

2 ビュー (過去 30 日間)
Dipesh Ramesh
Dipesh Ramesh 2013 年 11 月 18 日
編集済み: Dipesh Ramesh 2013 年 11 月 21 日
Hi,
I have a .csv file which contains stock information of Amazon e.g. date(30/10/2013), closePrice(361.08), volume(4500014), openPrice(362.62), highPrice(365), lowPrice(358.65). So there are about 2517 rows and 6 columns. First i want to read data from .csv file then plot a candlestick chart. So I have loaded my .csv file like this:
clear;
close all;
fid = fopen('Amazon.csv');
HDRS = textscan(fid,'%s %s %s %s %s %s',1, 'delimiter',',');
DATA = textscan(fid,'%s %f %f %f %f %f','delimiter',',');
fclose(fid);
outCell = cell(size(DATA{1},1), length(HDRS));
for i = 1:length(HDRS);
if isnumeric(DATA{i});
outCell(:,i) = num2cell(DATA{i});
else
outCell(:,i) = DATA{i};
end
end
candle (outCell{:,5}, outCell{:,6}, outCell{:,2}, outCell{:,4}, 'b', outCell{:,1});
but when running the file i get an error saying: Error using candle Too many input arguments. can someone help me i am sure matlab can read 2517X6 set of data to plot candlestick chart.
Thanks.
  2 件のコメント
Walter Roberson
Walter Roberson 2013 年 11 月 18 日
Why are you converting the numeric data into arrays of cells?
Dipesh Ramesh
Dipesh Ramesh 2013 年 11 月 19 日
I am using an array so my program can read date, i was having a problem reading date from .csv file so i used an array.

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

回答 (1 件)

Walter Roberson
Walter Roberson 2013 年 11 月 18 日
MATLAB Coder (the product you indicated you are using) is not able to generate code for anything involving graphics: it is only suitable for generating C or C++ code for numeric routines. MATLAB Coder is also, if I recall, unable to generate code when cell arrays are used.
The problems you would observe would be different than the message you indicate you saw, as the code generation process would fail long before you were able to run a call to candle()
The simplest explanation is that you are not using the MATLAB Coder product.
  3 件のコメント
Walter Roberson
Walter Roberson 2013 年 11 月 19 日
Could you show a sample line from the file?
Dipesh Ramesh
Dipesh Ramesh 2013 年 11 月 20 日
編集済み: Dipesh Ramesh 2013 年 11 月 21 日
This is how my .csv file looks like, is this the sample you're looking for right?
date, closePrice, volume, openPrice, highPrice, lowPrice
===============================================================
30/10/2013 361.08 4500014 362.62 365 358.65
29/10/2013 362.7 2184755 358.96 362.89 356.29
28/10/2013 358.16 3602497 359.92 362.75 357.2
25/10/2013 363.39 12034820 358.6 368.4 352.62
24/10/2013 332.21 5699188 329.63 332.6499 326.75
I want to use these data to plot candlestick chart. The file have 2,500 rows and 6 columns

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

カテゴリ

Help Center および File ExchangeAudio and Video Data についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by