Create array with 7500 1s, 5000 2s, 8003s etc.
이전 댓글 표시
I'm new to matlab, and I have to create a histogram based off a picture where the values are 7500 1s, 2500 2s, 800 3s and 100 4s. I think if I can get a row array with all those values (Order doesn't matter) I can make the histogram.
댓글 수: 3
Caleb Lindsey
2017년 9월 26일
James Tursa
2017년 9월 26일
편집: James Tursa
2017년 9월 26일
What have you done so far? What specific problems are you having with your code? Do you know how to construct row or column vectors of constant values? Do you know how to create a histogram?
Hint, to create an N-element row vector with constant value V:
x = V*ones(1,N);
Hint, to turn a row vector into a column vector:
x = your row vector
y = x(:); % <-- y will be a column vector
y = reshape(x,[],1); % <-- another way to get a column vector
Caleb Lindsey
2017년 9월 27일
답변 (1개)
Jos (10584)
2017년 9월 26일
help repmat
help cat
help reshape
help histogram
카테고리
도움말 센터 및 File Exchange에서 Resizing and Reshaping Matrices에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!