function [ sum_m ] = diffSum( )
%function [ sum_m ] = diffSum(beginning ,ending,dim)
tic%用来计时的,没什么作用,纯粹是为了跟大家讲解这么个用法
%利用while,for等语言实现简单求和运算,作者:nicolashe,2016年5月9日 11:13:26
% begin代码起始数,end代表终止数,都是闭口的,dim表示选择用的模式1表示
%表示采用while,2表示采用for,为了展示给你们看,采用switch,也可以使用if实现模式的选择,默认采用1
%%下面利用switch实现选择
%实际上我此时已经忘记了switch的语法,但是不要紧,可以即学即用啊,我查帮助文档得知
%{
help switch
switch Switch among several cases based on expression.
The general form of the switch statement is:
switch switch_expr
CASE case_expr,
statement, ..., statement
CASE {case_expr1, case_expr2, case_expr3,...}
statement, ..., statement
...
OTHERWISE,
statement, ..., statement
END
The statements following the first CASE where the switch_expr matches
the case_expr are executed. When the case expression is a cell array
(as in the second case above), the case_expr matches if any of the
elements of the cell array match the switch expression. If none of
the case expressions match the switch expression then the OTHERWISE
case is executed (if it exists). Only one CASE is executed and
execution resumes with the statement after the END.
The switch_expr can be a scalar or a string. A scalar switch_expr
matches a case_expr if swit