# How to generate a 1D array of zeros in Matlab?

623 views (last 30 days)
Devika Waghela on 24 Mar 2021
Commented: Jan on 6 Mar 2022
I want to create an 1D array of 100,000 elements in matlab full of zeros
##### 0 CommentsShowHide -1 older comments

Sign in to comment.

### Answers (2)

Jan on 24 Mar 2021
Edited: Jan on 24 Mar 2021
Please read the Getting Started chapters of the documentation and Matlab's Onramp: https://www.mathworks.com/learn/tutorials/matlab-onramp.html
It is not efficient if beginners ask all basic details in the forum.
x = zeros(1, 100000)
##### 2 CommentsShowHide 1 older comment
Jan on 6 Mar 2022
@José Montoya: Asking a question in the forum means to wait 10 minutes to 3 days in average for the answer. Therefore reading the documentation are running the online tutorials is much more efficient for the users, because it is faster and clarifies dozens of standard questions in a compact way. Asking them all would takes weeks until a beginner can start to write useful codes. With the tutorials this takes 1 or 2 hours only.
Remember, that this forum does not live from questions only, but from the answers. The answering persons are volunteers and their time is valuable. Then asking for details, which are explained in the tutorials and manuals exhaustively already, is not efficient, but it wastes time, which could be spent in answers, which are not found elsewhere already.
"The forum won't be crashing" - I do disagree. The forum would crash, if all beginners ask for all details, because then the forum is to boring to particpate and filled with noise. This is not a question of the servers, but on the persons, who post answers in their sparetime.
Sometimes it more useful to tell a user, how he or she can solve the problems by their own. It is like telling someone how to fish, instead of giving one fish.
The top 10 answers have posted about 170'000 answers since this forum was started in 2009. Some million additional questions would kill the forum.
Feel free to give as many answers as you can, for advanced or beginner questions.

Sign in to comment.

William Rose on 24 Mar 2021
data=zeros(100000,1); %column vector
data=zeros(1,100000); %row vector
##### 0 CommentsShowHide -1 older comments

Sign in to comment.

### Categories

Find more on Loops and Conditional Statements in Help Center and File Exchange

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!