郭彦甫Day2

2023-09-23 20 0

 

 

 dinv可以返回不可求逆的,inv只能求可逆阵的逆。

 

 

 

%%
%将字符串里的a都替换成z
str='ancsndkao';
'a'==str %找出a所在的位置
str(str=='a')='z';
str%%
clear;clc
%将字母调换
s1='I like the letter E'
s2=s1;
%s2='E rettel eht ekil I'
a=('I'==s2)
b=('E'==s2)
s2(a)='E';
s2(b)='I';
s2%%
%Returns a new array with assigned rows and columns
A = {'James Bond', [1 2;3 4;5 6]; pi, magic(5)}
C = reshape(A,1,4) %将A转化为一行四列
%Create a matrix B from the matrix A below using reshape
A = [1:3; 4:6];
B=reshape(A,3,2)%%
%保存变量为矩阵变量文件
clear; a = magic(4); 
save mydata1.mat
save mydata2.mat -ascii
load('mydata2.mat','-ascii')%%
%读取和输出excel文件
clear;clc
a=magic(5);
xlswrite('02score.xlsx',a)
Score = xlsread('02score.xlsx')
%Score = xlsread('02score.xlsx', 'B2:D4')
M = mean('Score')';
xlswrite('02Score.xlsx', M, 1, 'F1:F5');
S=std('Score')';
xlswrite('02Score.xlsx', S, 1, 'F6');%%
clear;clc
x = 0:pi/10:pi; y = sin(x); fid = fopen('sinx.txt','w');
for i=1:11
fprintf(fid,'%5.3f %8.4f\n', x(i), y(i));
end
fclose(fid); type sinx.txt%%
%1、array concatenation
A=[1,2;3,4];
B=[5,6;7,8];
C=cat(1,A,B) %竖向叠加
D=cat(2,A,B) %横向叠加
E=cat(3,A,B) %前后平行叠加%%
%2、多维行列
clear;clc
A{1,1}=[1,2;3,4];
A{1,2}='string';
A{2,1}=2-4i;
A{2,2}=7;A

 

代码编程
赞赏

相关文章

商务电子邮箱那个安全?怎么使用163邮箱最安全?
企业邮箱邮件迁移攻略,怎么把邮件同步到新注册的企业邮箱?
公司企业邮箱开通使用,收不到邮件怎么办?
邮件撤回方法详解,一键解决发错邮件的尴尬
公司邮件怎么备份?外贸企业邮箱邮件存储知识分享
春节假期怎么看公司邮箱邮件方便,好用的外贸企业邮箱推荐