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

조회 수: 1 (최근 30일)
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

답변 (0개)

카테고리

Help CenterFile Exchange에서 Whos에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by