How to track numbers in the MATLAB excel sheet?
1 次查看(过去 30 天)
显示 更早的评论
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.
0 个评论
回答(1 个)
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.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Spreadsheets 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!