How to plot a candlestick chart
3 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(1 个)
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 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Data Import and Analysis 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!