Trying the AI code generator for Matlab

Something to try, the official AI for Matlab: website (I expect it must require a free MathWorks account)

Screenshot of the AI interface

The generated code is not bad, some explanations are even added. Here for some simple examples, with the prompt on top:

% Display all the prime numbers between 100 and 200

lower_limit = 100;
upper_limit = 200;

prime_numbers = [];

for num = lower_limit:upper_limit
    if isprime(num)
        prime_numbers = [prime_numbers, num];
    end
end

prime_numbers

% The code is correct but quite lazy (which is positive)
% Draw a circle of diameter 2 with the center at x = -1 and y = 0.5

diameter = 2;
center_x = -1;
center_y = 0.5;

radius = diameter / 2;

figure;
rectangle('Position', [center_x - radius, center_y - radius, diameter, diameter], 'Curvature', [1 1]);
axis equal;
The circle drawned, yes it seems correct.

History

# Date User Information
140 8 months ago Jerome Degallaix (current)
139 8 months ago Jerome Degallaix (original)

Leave a Reply