display the names and values of the 3 random variables on the screen. in matlab

To display the names and values of random variables on the screen in MATLAB, you can use the disp function. First, assign values to the variables, and then use disp to show the variable names along with their values. Here's an example:

main.m
% Generate three random variables
var1 = rand();
var2 = rand();
var3 = rand();

% Display the variable names and values
disp(['Variable 1: ' num2str(var1)]);
disp(['Variable 2: ' num2str(var2)]);
disp(['Variable 3: ' num2str(var3)]);
234 chars
10 lines

This will print the variable names (e.g., "Variable 1") followed by their corresponding values on the screen. You can replace var1, var2, and var3 with the names of your variables.

gistlibby LogSnag