• Re: RickRolling in MATLAB

    From Gregory Parsons@21:1/5 to All on Tue Apr 12 20:32:27 2022
    On Tuesday, October 9, 2018 at 9:12:39 AM UTC+11, evanb...@gmail.com wrote:

    clear, clc

    url = 'https://www.youtube.com/watch?v=dQw4w9WgXcQ';
    %^^^ place desired url there
    string = "web('" + url + "','-browser')";
    list = double(char(string));

    numberOfChar = numel(list);
    lengthOfArrays = floor(numberOfChar/4);
    reminding = rem(numberOfChar, 4);
    x1 = [];
    x2 = [];
    x3 = [];
    x4 = [];
    for i = 1:1:lengthOfArrays
    x1(end+1) = list(1,i);
    x2(end+1) = list(1,i+lengthOfArrays);
    x3(end+1) = list(1,i+2*lengthOfArrays);
    x4(end+1) = list(1,i+3*lengthOfArrays);
    end

    for i = 1:1:reminding
    x4(end+1) = list(1, 4*lengthOfArrays+ i);
    end

    fmt=['x1 = [' repmat(' %1.0f',1,numel(x1))];
    fprintf(fmt,x1)
    fprintf('];\n')


    fmt=['x2 = [' repmat(' %1.0f',1,numel(x2))];
    fprintf(fmt,x2)
    fprintf('];\n')

    fmt=['x3 = [' repmat(' %1.0f',1,numel(x3))];
    fprintf(fmt,x3)
    fprintf('];\n')

    fmt=['x4 = [' repmat(' %1.0f',1,numel(x4))];
    fprintf(fmt,x4)
    fprintf('];\n')

    disp('eval(char([x1 x2 x3 x4]))')

    (Prints to the console the code that Matthew wrote, url can be swapped for any desired link. Not the cleanest code, but you get the idea)

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)