Clear Filters
Clear Filters

Cant seem to this to line up. cell is created perfectly fine but strange issues happen.

1 view (last 30 days)
I have no idea why cells are not where they should be
clc;
[X, Y] = parseCMC(30);
function [X, Y] = parseCMC(size)
X = repmat({''},size,15);
X2 = repmat({''},size,15);
soup = urlread('https://api.coinmarketcap.com/v1/ticker/');
indexes = strfind(soup, '"');
Y = zeros(size,2);
Y = num2cell(Y);
Y{1,1} = 'COIN';
Y{1,2} = 'PRICE (usd)';
k2 = 0;
for ii = 1 : size
level = (ii - 1) * 56 + 3;
for k = 1 : 15
start = indexes(level + (k - 1) * 4) + 1;
last = indexes(level + (k - 1) * 4 + 1) - 1;
X(ii, k) = cellstr(soup(start : last));
str = X(ii,k);
if k > k2
L = strlength(str);
if L == 3
k2 = 16;
end
switch L
case 3
start = indexes(level + (k - 1) * 4) + 1;
last = indexes(level + (k - 1) * 4 + 1) - 1;
iii = ii + 1;
Y{iii,1} = str;
otherwise
end
end
end
k2 = 0;
L = 0;
end
end

Answers (0)

Community Treasure Hunt

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

Start Hunting!