matlab switch case 不太会用,程序一直有错.
来源:学生作业帮 编辑:搜搜做题作业网作业帮 分类:综合作业 时间:2024/05/05 13:24:10
matlab switch case 不太会用,程序一直有错.
clc;
clear;
x=0:0.1*pi:2*pi;
a=input('name:')
switch a
case 'sin'
y=sin(x);
plot(x,y)
case 'cos'
y=cos(x);
plot(x,y)
case 'tan'
y=tan(x);
plot(x,y)
otherwise
break;
end
clc;
clear;
x=0:0.1*pi:2*pi;
a=input('name:')
switch a
case 'sin'
y=sin(x);
plot(x,y)
case 'cos'
y=cos(x);
plot(x,y)
case 'tan'
y=tan(x);
plot(x,y)
otherwise
break;
end
不是case的问题,你这里case的用法没有问题
是输入语句的问题,应该改为
a=input('name:','s');
多一个参数's'表面输入的内容是字符串,就好了
是输入语句的问题,应该改为
a=input('name:','s');
多一个参数's'表面输入的内容是字符串,就好了
matlab switch case 不太会用,程序一直有错.
matlab 程序 哪儿有错?
matlab的switch case可以用矩阵么
下面程序段的输出结果[] m=1; switch (m) { case 1:m++; case 2:m- -; case
switch case语句题目
matlab switch case 语句不能用?(从书上抄的)
一下matlab程序运行有误,请问哪里有错,
matlab程序找错 显示的是function那行有错
matlab switch 语句:
matlab switch怎么使用?
do{ switch case‘a':case'A':case'e':case'E':case'i':case'I':c
有如下程序,该程序的输出结果是( ) main0 { int x=1,a=0,b=0; switch(x){ case