matlab GUI读取G代码在Edit,多行显示显示

本文介绍如何使用MATLAB通过uigetfile对话框选择文件,并读取选定的文本文件内容,最后在编辑框中展示文件的具体内容。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

在perprosprity 里面::设置max min,可以进行对行显示

否则和消失。

按钮点击打开文件:

然后再edit显示出代码

[filename pathname]=uigetfile({'*.txt','txt-file(*.txt)';'*.*','All the files(*.*)'},'Choose a file');

if isequal(filename,0)||isequal(pathname,0);
    h=msgbox ('Please choose a file!','Warning','warn');
    return;
else
% [FileName,PathName] = uigetfile('*.KGF','Select the Data file'); 
    path2=fullfile(pathname,filename)
    fidin=fopen(path2); %打开文件
  
    if  ~feof(fidin)  
     tline=fgetl(fidin);  
     str=[tline,10]
    end
    while ~feof(fidin)  
     tline=fgetl(fidin);  
     str1=[tline,10]
     str=[str,str1]
    end
    set(handles.editCode,'string',str1)
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值