How to plot a candlestick chart
Mostrar comentarios más antiguos
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 comentarios
Walter Roberson
el 18 de Nov. de 2013
Why are you converting the numeric data into arrays of cells?
Dipesh Ramesh
el 19 de Nov. de 2013
Respuestas (1)
Walter Roberson
el 18 de Nov. de 2013
0 votos
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 comentarios
Dipesh Ramesh
el 19 de Nov. de 2013
Editada: Walter Roberson
el 19 de Nov. de 2013
Walter Roberson
el 19 de Nov. de 2013
Could you show a sample line from the file?
Dipesh Ramesh
el 20 de Nov. de 2013
Editada: Dipesh Ramesh
el 21 de Nov. de 2013
Categorías
Más información sobre Bar Plots en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!