当前位置:网站首页>matlab-day01
matlab-day01
2022-04-22 23:28:00 【__Miracle__】
Matlab 命令窗口模式编程
- 交互式编程

变量名 = 变量值;

没 ; 会返回交互式的值, 有 ; 代表这一句话结束

变量必须声明之后才能使用
-
清除变量 clear

-
只写clear 所有变量都没了
-
clc 清屏
-
who / whos 可以查看当前我们有的所有变量

文件式编程

-
save myfile 保存工作区
-
load myfile 加载工作区
-
一行声明多个变量
- 关系运算符


逻辑运算符
- 与 &&
- 或 ||
- 非 ~
a = 2; b = 10; c =100
(a <b) && (b < c)
(a <b) || (b < c)
~(a <b)
if 语句
格式:
if <表达式>
<条件语句>
end
if <表达式>
<满足条件语句>
else
<不满足条件语句>
end
if <表达式1>
<满足条件1语句>
elseif <表达式2>
<满足条件2语句>
elseif <表达式3>
<满足条件3语句>
...
else
<不满足条件语句>
end
% if判断
age = -2;
if age >= 18 && age <=150
fprintf('恭喜你成年了');
elseif age >= 0 && age <18
fprintf('你还未成年');
else
fprintf('年龄错误');
end
循环
- while循环
while <表达式>
<循环体>
end
- 1 ~ 100的累加和
%while循环
i = 1;
sums = 0;
while (i <= 100)
fprintf('cur value is : %d\n', i);
sums = sums + i;
i = i + 1;
end
fprintf('sums value is : %d\n', sums);
版权声明
本文为[__Miracle__]所创,转载请带上原文链接,感谢
https://blog.csdn.net/qq_39276337/article/details/124350284
边栏推荐
- STM32 内存分配解析及变量的存储位置
- LeetCode 414. The third largest number (simple, array) day13
- Golang中json.Marshal避坑
- 【PCIe 6.0】PCIe 6.0 新特性 - L0p 详解
- 51 单片机学习_4-1 数码管显示
- JS has several red, white and black balls, including 25 red and white balls, 31 white and black balls and 28 red and black balls. Find the number of each of the three balls.
- VI / VIM editor basic operation
- 居家第二十二天的绿豆芽
- Pytorch convolution kernel filling and stride, multiple input and multiple output channels, pool layer
- 华为机试题——HJ73 计算日期到天数转换
猜你喜欢

【毅力挑战】PCIe 每日一问一答(2022.04 进行中)

English | day13,14 x sentence true research daily sentence (parallel and nested structure)
![[newcoder] week 20220422](/img/cd/3d24d3b5be26166ab94742da8c46dd.png)
[newcoder] week 20220422

VsCode使用EmmyLua插件调试Unity工程ToLua代码
![[dvcon2020] simulation acceleration method based on multithreaded UVM test platform](/img/84/71895a669fef22b172183ae805427d.png)
[dvcon2020] simulation acceleration method based on multithreaded UVM test platform
![[原创][开源]C# Winform DPI自适应方案,SunnyUI三步搞定](/img/06/e1fec4a87eca3142d54d09844c629f.png)
[原创][开源]C# Winform DPI自适应方案,SunnyUI三步搞定

Unity uses newtonsoft JSON plug-in realizes the conversion of XML and JSON data

【PCIe 实战】SNPS PCIe 开启 SRIS mode
![High number | [differential calculus and application of multivariate functions] error prone problems and detailed explanation of Li Lin 880](/img/24/2c2fa861bc0fb3e0a33d13ce01db38.png)
High number | [differential calculus and application of multivariate functions] error prone problems and detailed explanation of Li Lin 880

Method of shrinking master-slave nodes in redis cluster cluster
随机推荐
[BJDCTF2020]Easy MD5
Webrtc series - webrtc Foundation (VII) NAT, stun and turn (2)
读《Software Engineering at Google》(13)
MySQL configuration adjustment: case insensitive
企业微信扫码登录后台管理系统,如何修改二维码样式
[leetcode refers to the path with a certain value in offer 34. Binary tree (medium)]
Query uid from proc
LeetCode 16. 最接近的三数之和(中等、数组)day13
Django connects to the database to obtain data
L1-049 ladder race seat allocation (20 points) (in-depth understanding of for loop + three-dimensional array + error analysis)
[chestnut sugar GIS] the essence of programming - (video notes)
Go的定时器之Time.Ticker
2面技术 HR面 offer,系列篇
cache与buffer
High number | [differential calculus and application of multivariate functions] error prone problems and detailed explanation of Li Lin 880
[newcoder] week 20220422
读《Software Engineering at Google》(12)
LeetCode 16. The sum of the nearest three numbers (medium, array) day13
【笔记】PCIe LTSSM 状态转移
Install mujoco and mujoco on win10_ py,gym