当前位置:网站首页>Day (4) of picking up matlab
Day (4) of picking up matlab
2022-04-23 15:59:00 【Sola_ Ex】
Pick up MATLAB My fourth day
Matlab
if Use
if Conditions
esleif Conditions
....
else
end
switch Use
switch Variable
case Conditions 1
Perform tasks 1
case Conditions 2
Perform tasks 2
....
otherwise
Perform other
end
Input statement
X = input('message') % Input data format
X = input('message','s') % Input string format
notes : Inside massage You can write something else , Such as : Please export xxx. In data format , Using a string will result in an error . String supports Chinese input .
Output statement
disp()
I think this disp() Your orders are interesting , Rich and colorful formats , Such as :
disp(' Xu Lao is very awesome ') % Print characters directly
disp([' peng ',[' Guy '],[' It's also awesome '])
disp(666)
disp([' Xu Lao ',num2str(666)]) % Printing effect , Xu Lao 666
Format output :
fprintf(formatSpace,A) %formatSpace Is the format type ,A Is the output
Such as :
fprintf(' Xu Lao long %d\n cm',14) % effect : Xu Lao long 14 cm
fprintf(' Guijia long %4.1f\n cm',5.1) % effect : Guijia long 5.1 cm
In fact this with C The language is very similar to .
for loop
for Loop control variable = Variable range
Execute statement
end
Such as :
for a=10:20
fprintf('value is %d\n',a)
end
The final result is to print 10-20 All integers of ( In steps of 1)
while loop
while Judge the condition
Execute statement
end
Be careful :while The judgment conditions in , It's actually if It's the same inside .
break And continue
break Use , Such as :
while true
....
if Conditions met
break;
end
end
if Inside break immediate withdrawal while loop ,
continue Use , Such as :
while true
....
if Conditions met
continue;
end
end
The function is to exit this while loop , Then go on to the next while.
Special reminder :
stay matlab in , Whether through script (.m file ) Or directly in cmd windows Executed under while, If while Always in a cycle , And you want to stop , You can press ctrl +c Forced shutdown .( I've got the blue screen of the computer )
版权声明
本文为[Sola_ Ex]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204231554164141.html
边栏推荐
- Do we media make money now? After reading this article, you will understand
- Nanny Anaconda installation tutorial
- pywintypes. com_ Error: (- 2147221020, 'invalid syntax', none, none)
- The biggest winner is China Telecom. Why do people dislike China Mobile and China Unicom?
- leetcode-396 旋转函数
- How can poor areas without networks have money to build networks?
- Metalife established a strategic partnership with ESTV and appointed its CEO Eric Yoon as a consultant
- 建设星际计算网络的愿景
- Spark 算子之distinct使用
- Coalesce and repartition of spark operators
猜你喜欢
Config learning notes component
Timing model: gated cyclic unit network (Gru)
GRBL学习(一)
Why disable foreign key constraints
CVPR 2022 quality paper sharing
One brush 314 sword finger offer 09 Implement queue (E) with two stacks
Jour (9) de ramassage de MATLAB
API IX JWT auth plug-in has an error. Risk announcement of information disclosure in response (cve-2022-29266)
Metalife established a strategic partnership with ESTV and appointed its CEO Eric Yoon as a consultant
【现代电子装联期末复习要点】
随机推荐
ESP32_Arduino
js正則判斷域名或者IP的端口路徑是否正確
linux上启动oracle服务
Extract non duplicate integers
GRBL学习(一)
R语言中实现作图对象排列的函数总结
【开源工具分享】单片机调试助手(示波/改值/日志) - LinkScope
C language --- string + memory function
捡起MATLAB的第(5)天
Fastjon2他来了,性能显著提升,还能再战十年
homwbrew安装、常用命令以及安装路径
Timing model: gated cyclic unit network (Gru)
运维流程有多重要,听说一年能省下200万?
PS add texture to picture
Why is IP direct connection prohibited in large-scale Internet
Open source project recommendation: 3D point cloud processing software paraview, based on QT and VTK
Use bitnami PostgreSQL docker image to quickly set up stream replication clusters
Nanny Anaconda installation tutorial
pywintypes. com_ Error: (- 2147221020, 'invalid syntax', none, none)
Best practices of Apache APIs IX high availability configuration center based on tidb