Lane 发表于 2018-11-8 16:02:58

求助,s function模块编程运行报错

function y =selectionSort(arr,u)
var arr;   
y=zeros(1,6);
    for i = 0:5;
      minIndex = i;
      for j=i + 1:6;
            if arr(j) < arr(minIndex)      %寻找最小的数
                minIndex = j;            %将最小数的索引保存

            end
      end
      temp = arr(i);
      arr(i) = arr(minIndex);
      arr(minIndex) = temp;   
      if 2> u/10>1
         y(j)=1;         
      else if 3> u/10>2
         y(j)=1   ;
      else if 4> u/10>3
         y(j)=1   ;
      else if 5>u/10>4
         y(j)=1;
      else if 6>u/10>5
         y(j)=1   ;
      else if u/10>6
         y(j)=1;
            end
            end
            end
            end
            end
      end
    end
   return
程序如上所示,仿真接线如图,当开始运行时显示如图1,点击继续显示如图2

Lane 发表于 2018-11-8 16:03:33

强烈支持楼主ing……
页: [1]
查看完整版本: 求助,s function模块编程运行报错

招聘斑竹