Getting Started with MATLAB and Live Scripts · Study

English translation

Topics covered

Run commands and inspect variables, then create a Live Script that records input conditions alongside results.

Command Window and Workspace

Running calculations in the Command Window leaves variables and values in the Workspace. A semicolon suppresses displayed output without affecting whether variables are stored.
First check results with short commands, then move them into a Live Script.

Write code that can be rerun

A Live Script contains explanations, code, and outputs in one document. Define inputs before the code that uses them, and include units in variable names to help distinguish distance from time.
Reopening the file and running from the top must produce the same results.

Connect to Onramp

Try entering commands, using variables, and running scripts in Commands and MATLAB Desktop and Editor in the official Onramp. The example below uses these features to calculate travel distance and time.

Worked example

Calculate the time needed to travel 0.6 m at 0.3 m/s. Perform calculations only; do not send drone commands.
distance_m=0.6;
speed_mps=0.3;
travel_time_s=distance_m/speed_mps;
angle_deg=90; angle_rad=deg2rad(angle_deg);
disp(travel_time_s); disp(angle_rad);
assert(abs(travel_time_s-2)<1e-12);

Example results

Travel time is 2 seconds, and 90 degrees is π/2 rad.

Official learning materials