📄 count_num.m
字号:
function [First, Last] = Count_num(array, int)
% Given an array and an integer, this function returns the first occurance
% of that integer and the number of integers that occur within the array
count = 0;
i = 1;
initial = 0;
first = 0;
while(i<=length(array))
if(array(i) == int)
count = count + 1;
if(initial == 0)
first = i;
initial = 1;
end
end
i = i + 1;
end
First = first;
Last = count + first - 1;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -