data = fetch(c, 'goog''csco''ibm''intc''aapl''bac''cvx''f''gs''hon''jnj''k''lmt''msft''m''nok''orcl''pg''qcom''si','last');'val(end+1) = data(1).last;''time(end+1)=rem(now,1);'

% Code to connect matlab and mysql database and provide values from mysql to matlab
mysql( 'open', 'localhost:3306', 'root', 'ateet' )
% Connecting to  host=localhost  port=3306  user=root  password=puneet
% Type of response expected
%Uptime: 2905  Threads: 1  Questions: 570  Slow queries: 0  Opens: 0  Flush tables: 1  Open tables: 3  Queries per second avg: 0.196

mysql('use test_schema')
% Current database is "test_schema"

[ID_p] = mysql('select OrganizationID from organizationtable');
ID_p = transpose(ID_p);
len = length(ID_p);

for x = 1:len
%     var1 = data.Last(x);
%     var2 = ID_p(x);
    
    mysql(['update organizationpredict set organizationpredict.OrganizationID = ',num2str(ID_p(x)),',organizationpredict.currentprice = ',num2str(data.Last(x)),' where organizationpredict.OrganizationID = ',num2str(ID_p(x)),'']);
end

mysql ('close');
