matlab
大熊学编程
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
matlab 各类符号意义
… 表示连接语句,语句太长写不下,需要换行的时候使用。 把 … 去了,语句写成一行,与原先具有相同结果 S=B(1:end-2,2:end-1)+B(3:end,2:end-1)+B(2:end-1,1:end-2)+B(2:end-1,3:end)+B(2:end-1,1:end-2)+B(1:end-2,3:end)+B(3:end,1:end-2)+B(3:end,3:end);下面是MATLAB中常用的一些标点及其含义: 1. MATLAB中常用标点及其含义标点符号 定义; 区分行原创 2021-06-30 21:35:53 · 3404 阅读 · 0 评论 -
matlab uigetfile
function [FileName,PathName,FilterIndex] = uigetfile(FilterSpec,DialogTitle,DefaultName)参数FileName:返回的文件名PathName:返回的文件的路径名FilterIndex:选择的文件类型FilterSpec:文件类型设置DialogTitle:打开对话框的标题DefaultName:默认指向的文件名使用方法1.最简单的形式,只设置了一种可选择的文件类型[FileName,PathName]原创 2021-06-30 15:30:44 · 484 阅读 · 0 评论 -
matlab 保存和加载变量
保存变量:savesave data1:表示保存工作空间所有的变量到data1.mat中。save data2 m:表将工作空间的m变量保存到data2.mat中,如果工作空间没有m会报错。save data3 m n p v: 表示将工作空间中的 m n p v 四个变量保存到data3.mat中,如果工作空间没有这四个变量中的一个也会报错。加载变量:双击data1.mat 或 load data1.mat...原创 2021-06-24 09:46:36 · 1176 阅读 · 0 评论 -
matlab创建文件夹与批量移动文件到单一文件夹或者各自文件夹
代码备份自用的,可参考movefile 函数clear clc cd('C:\EO');%设置当前目录:current directory for i = 1 : 47 folderName{i} = ['sub_', num2str(i)]; mkdir(folderName{i}); % 新建一个文件夹 end eval(['load ',prefix_common,'_ec_fft_stsp_sub_',num2str(i,'%03d'),'.m原创 2021-06-24 09:44:19 · 1247 阅读 · 0 评论 -
matlab访问路径问题
当前路径下 (mat和m文件在一起): load .mat;在下一级路径下: load .\下一级路径的文件名*.mat;在上一级路径下: load …*.mat;在平行文件夹内: load …\平行的文件夹**.mat;例如,读写当前目录下aaaa文件夹中的x.txt文件fid = fopen(’.\aaaa\x.txt’, ‘wt’);fprintf(fid, ‘%s\n’, ‘1234’);fclose(fid);在上两(或若干级)路径下:s = pwd; % 获取原创 2021-06-24 09:38:52 · 664 阅读 · 0 评论 -
matlab Gui set get
function varargout = test2(varargin)% TEST2 MATLAB code for test2.fig% TEST2, by itself, creates a new TEST2 or raises the existing% singleton*.%% H = TEST2 returns the handle to a new TEST2 or the handle to% the existing singleto原创 2021-06-06 16:52:55 · 377 阅读 · 0 评论 -
matlab 图像处理
利用灰度阈值调整图像I=imread('rice.png');level=graythresh(I);bw=im2bw(I,level);subplot(1,2,1);imshow(I);%imshow展示灰度图像subplot(1,2,2);imshow(bw);I=imread('rice.png');subplot(1,3,1);imshow(I);bg=imopen(I,strel('disk',15));%提取背景图像subplot(1,3,2);imshow(bg);I2原创 2021-03-29 08:08:37 · 426 阅读 · 0 评论 -
直方图均衡化
I=imread('pout.tif');I2=histeq(I);subplot(1,4,1);imhist(I);subplot(1,4,2);imshow(I);subplot(1,4,3);imshow(I2);subplot(1,4,4);imhist(I2);图像的灰度直方图表征的是该图像的灰度分布原创 2021-03-28 10:45:26 · 156 阅读 · 0 评论 -
matlab 图像操作
I=imread('abc.png');J=imread('2abc.png');I1=imresize(I,[254 256]);%将两张图像调整为相同的大小K=imadd(I1,J);%将J放到I1图像上subplot(1,2,1);imshow(I1);subplot(1,2,2);imshow(K);图像乘法操作I=imread('abc.png');subplot(1,2,1);imshow(I);j=immultiply(I,1.2);subplot(1,2,2);im原创 2021-03-27 21:44:00 · 162 阅读 · 0 评论 -
matlab 图像保存方法
saveas与imwriteimwrite可以保存图像处理后的图像;I=imread('1.png');gr=rgb2gray(I);imwrite(gr,'abc.png')saveas(句柄,’路径及名称‘,‘保存图像类型’)saveas函数可以将指定figure中的图像或者simulink中的框图进行保存。saveas的格式为:saveas(gca, filename, fileformat),其中的三个参数:(1)gca:图形句柄,如果图形窗口标题栏是“Figure 3”,则句柄就原创 2021-03-27 17:27:51 · 1662 阅读 · 0 评论 -
matlab直方图,饼图
y=randn(1,10000);subplot(2,1,1);hist(y,10);title('bins=10');subplot(2,1,2);hist(y,50);title('bins=50');x=[1 2 5 7 8];y=[x;1:5];subplot(1,2,1);bar(y);title('stacked');subplot(1,2,2);barh(y);title('Horizontal');a=[10 5 20 30];subplot(1,3原创 2021-03-24 09:33:06 · 383 阅读 · 0 评论 -
matlab subplot
t=1:1/100:2;f=t.^2;g=sin(2.*pi.*t);subplot(2,2,1);plot(t,f,'k',t,g,'*r');%axis normal%正常subplot(2,2,2);plot(t,f,'k-.',t,g,'y.');%axis square%x=ysubplot(2,2,3);plot(t,f,'ok--',t,g,'or');%axis equal%x,y所占的单元格一样subplot(2,2,4);plot(t,f,'*k',t,g,'or');%ax原创 2021-03-23 21:23:13 · 504 阅读 · 0 评论 -
plot(2)
x=0:0.5:4*pi;y=sin(x);h=cos(x);w=1./(1+exp(-x));g=(1/(2*pi*2)^0.5).*exp((-1.*(x-2*pi).^2)./(2*2^2));plot(x,y,'bd-',x,h,'gp:',x,w,'ro-',x,g,'c^-');%不需要把四条线拆开来写,xlabel('four function');ylabel('vaule');title('test plot');legend('sinx','cosx','sigmod'原创 2021-03-23 19:55:51 · 520 阅读 · 0 评论 -
matlab plot
plot(sin(0:pi/10:2*pi))hold on plot(sin(0:pi/10:2*pi)); plot(cos(0:pi/10:2*pi)); hold off`hold onplot(sin(0:pi/10:2pi),‘sy-.’);plot(cos(0:pi/10:2pi),’*:m’);hold off`x=0:0.5:4*pi; y=sin(x); h=cos(x); w=1./(1+exp(-x)); g=(1/(2*pi*2)^0.5).*exp((-1.*(x-2原创 2021-03-23 10:04:12 · 233 阅读 · 0 评论 -
matlab fscanf
clear all;clc;fid=fopen('data1.txt','r');i=1;while ~feof(fid)%~feof(fid)循环到文件结束处 name(i,:)=fscanf(fid,'%5c',1);% '%5c'表示读取字符的位数(5位)其他的不读取,1->表示读取的个数 year(i)= fscanf(fid,'%d',1); no1(i)=fscanf(fid,'%d',1); no2(i)=fscanf(fid,'%d',1);原创 2021-03-23 09:06:21 · 490 阅读 · 0 评论
分享