How to track numbers in the MATLAB excel sheet?

조회 수: 2 (최근 30일)
Tony
Tony 2014년 5월 2일
편집: Justin 2014년 5월 2일
I asked a function to run which produces a lot of numbers which I then can see in the MATLAB excel sheet. Is there a way to find out how many times a certain number showed up in the excel sheet or have it highlight every one of a certain number?
thanks.

답변 (1개)

Justin
Justin 2014년 5월 2일
편집: Justin 2014년 5월 2일
I believe the correct name for what you are referring to as the Matlab excel sheet is called the Variable Editor.
A simple answer to your question would be to take a sum of all values in the array equal to the number you are interested in.
For example:
% define your array
x = [1 2 3 4 3 4 3 2 1 3];
% x == 3 will make a logical array where there will be a one for every value that is equal to 3
isValue = x == 3;
% sum will add up all the values in the logical array giving you a count of how many number threes there are
count = sum(isValue(:))
I would definitely recommend going to this site http://www.mathworks.com/academia/student_center/tutorials/launchpad.html and doing the Getting Started with MATLAB tutorial. Also take a look at http://www.mathworks.com/products/matlab/examples.html.

카테고리

Help CenterFile Exchange에서 Spreadsheets에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by