找回密码
 注册
Simdroid-非首页
查看: 174|回复: 4

【求助】好几个问题!谢谢

[复制链接]
bessie 该用户已被删除
发表于 2002-8-10 20:56:40 | 显示全部楼层 |阅读模式 来自 北京理工大学
提示: 作者被禁止或删除 内容自动屏蔽
发表于 2002-8-11 19:34:53 | 显示全部楼层 来自 广东湛江

Re:【求助】好几个问题!谢谢

Simdroid开发平台
1. popup的value值代表下拉的选项,1代表第一项,二代表第二项,依此类推. 要改变文本框的背景颜色,可用如下代码:
    set(handles.text,'Color',[1 1 1]);  %中括号中的为rgb
2.用uiputfile,用法如下
[file,path]=uiputfile(.......  
w=cd; %先保存你现在的路径  
cd(path);%先到文件的目录处  
save a file;%存数  
cd(w);%返回原目录  
...  
3. 对界面,用figure(filename);对函数,也是直接写出函数名
5.用listbox就可以解决这方面的问题,还简单
bessie 该用户已被删除
 楼主| 发表于 2002-8-12 16:03:45 | 显示全部楼层 来自 北京理工大学
提示: 作者被禁止或删除 内容自动屏蔽
发表于 2002-8-12 22:06:54 | 显示全部楼层 来自 北京

Re:【求助】好几个问题!谢谢

关于uiputfile的用法,我这里有一个文件可以参考一下。uiputfile的作用是以界面的方式提供保存文件的路径和文件名。可以参考Matlab本身的帮助文件。help uiputfile。
至于保存参数,可以用任何格式保存,完全由自己定义。我认为,可以用txt文件,也可以直接用SAVE命令保存为*.mat格式,关键是保存和读取方便。这也可以参照这个文件。
  
function flag=write_env_txt(header,data);
  
%write a envi ascii file,header is the header information in the file
%data is the actual data of the file
%the whole file include two parts: header and data, is saved as ASCII file.
  
%written by Xiaohong,Lv, 5/22 2002,  
%Email-address: chenjialv@163.net, Xidian University
%all rights be reserved by Xiaohong, Lv
  
flag=-1;
sz=size(header);
header=header';
temp=header(:)';
if findstr(temp,'ENVI')==[]
    error('this is not a ENVI file');
end
tempdir=pwd;
[filename,pathname]=uiputfile({'*.txt','ENVI ASCII file'},'Input the filename *.txt');
cd (pathname);
fid=fopen(filename,'w');
if fid==-1
    error('cannot open the file');
end
  
row=sz(1);
col=sz(2);
for i=1:row
    fprintf(fid,'%s',header(:,i));
    fprintf(fid,'\n');
end
sz=size(data);
row=sz(1);
col=sz(2);
for i=1:512
    for j=1:512
        fprintf(fid,'%-14.4f',data(i,j));
    end
    if i~=512
    fprintf(fid,'\n');
    end
end
flag=1;
fclose(fid);
cd (tempdir);
bessie 该用户已被删除
 楼主| 发表于 2002-8-19 12:22:44 | 显示全部楼层 来自 北京理工大学
提示: 作者被禁止或删除 内容自动屏蔽
您需要登录后才可以回帖 登录 | 注册

本版积分规则

Archiver|小黑屋|联系我们|仿真互动网 ( 京ICP备15048925号-7 )

GMT+8, 2024-5-6 19:27 , Processed in 0.034010 second(s), 14 queries , Gzip On, MemCache On.

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表