create an array and fill it with the same number in matlab

To create an array and fill it with the same number in MATLAB, you can use the repmat function.

Here is an example of creating an array of size [3, 3] and filling it with the number 5:

main.m
% Create an array of size [3, 3] filled with the number 5
array = repmat(5, [3, 3]);
85 chars
3 lines

This will create an array array with dimensions 3x3 and all elements will be filled with the value 5.

You can change the size of the array and the number you want to fill it with according to your requirements.

related categories

gistlibby LogSnag