问题描述: matlab:编写一个M函数文件,比较五个数的大小,并能返回五个数中的最大值和最小值. 1个回答 分类: 综合 2014-10-23 问题解答: 我来补答 function [xmax,xmin]=xsort(x)x=sort(x);xmax=x(end)xmin=x(1) 再问: 不对啊。显示出这个??? Strings passed to EVAL cannot contain function declarations 再答: 怎么还有eval的事儿啊,你怎么用的再问: 额,不好意思,结果是这个Error in ==> C:\MATLAB6p5\work\xsort.m On line 2 ==> x=sort(x); 再答: 首先你要把那4行存成一个 xsort.m 然后在命令行里面输入: >> x=rand(5,1); >> [xmax,xmin]=xsort(x)再问: xmax = 0.8214 xmin = 0.0185 xmax = 0.8214 xmin = 0.0185 结果是这个,对不对? 展开全文阅读