make a random 7 by 1 mareix with number from 1 to 30 in matlab

To create a random 7 by 1 matrix with numbers from 1 to 30, you can use the randi() function in MATLAB. The randi() function generates random integer values within a specified range.

Here's the code to generate the matrix:

main.m
A = randi([1 30], 7, 1);
25 chars
2 lines

In this code, we specified the range of numbers as [1 30] (i.e., numbers from 1 to 30), and the size of the matrix as 7 by 1. The randi() function generates the random integer values within this range and stores them in the matrix A.

gistlibby LogSnag