MATLAB: How to insert many variables(upto 100) into one function

multiple variables

I have variables with value
B1=1 B2=2 B3=4 B4 ... B100= some number
(it goes on to 100 variables)
then I want to insert all of these variables into one function
save('filename.mat', 'B1', 'B2', 'B3'.... 'B100')
However, it will be very counterproductive to write all the 100 variables…
how do i shorten this function?

Best Answer

B = zeros(100,1);
B(1) = 1;
B(2) = 2;
B(3) = 4;
B(4) = ...
B(5) = ...
...
...
B(100) = ...
save('filename.mat', 'B');