声振论坛

 找回密码
 我要加入

QQ登录

只需一步,快速开始

查看: 1129|回复: 2

[综合讨论] 跪求,matlab数据修改保存问题

[复制链接]
发表于 2009-3-27 21:50 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?我要加入

x
大侠们,版主们,现我有问题如下,希望你们能帮助。
我做了个修改数据库的程序,可以增加数据,可以修改数据,可以删除数据
增加数据的时候代码如下   
  stra=strcat('A',num2str(j));


    strb=strcat('B',num2str(j));
    strc=strcat('C',num2str(j));
    strcode1=mat2cell(strcode1);      %这个就是解决写入数据库的时候完整的写入每格,如果不用mat2cell写入的时候入下面图示。
    strname1=mat2cell(strname1);     %假设变量的值是strcode1=123456strname1=中原strshort1=ZY
    strshort1=mat2cell(strshort1);   
    xlswrite(str3,strcode1,'sheet1',stra);
    xlswrite(str3,strname1,'sheet1',strb);
    xlswrite(str3,strshort1,'sheet1',strc);
但是,当我对新增加的数据进行删除或者修改的时候,就不运行了,listbox就隐藏起来了,并且数据也确实删除了,出现以下警告
Warning: single-selection listbox control requires that Value be an integer within String range
Control will not be rendered until all of its parameter values are valid.
Warning: Single input behavior is obsolete and will be removed in a
         future release of MATLAB. Use C={X} instead.
> In mat2cell at 54
  In Update>pushbutton7_Callback at 393
  In gui_mainfcn at 95
  In Update at 46
Warning: Single input behavior is obsolete and will be removed in a
         future release of MATLAB. Use C={X} instead.
不知道什么问题,不是很清楚,请高手指教,万分感谢。
第一个图是我新增加的数据
第二个图就是我对新增加的数据进行删除的时候,listbox就不见了。提示错误如上。
1.jpg
2.jpg
回复
分享到:

使用道具 举报

发表于 2009-3-27 22:06 | 显示全部楼层
删除完后把listbox的value属性设置成1,当然也可以设置成允许范围内的值,按你的要求来
我估计你每次是删除最下面那个吧?假设有5个条目,删除最下面的条目之前,value值是最大值,5,删完之后,只有4个条目了,value最大值只能是4,但是此时却等于5,这是不允许的。matlab报错就是说value值超出了允许范围

[ 本帖最后由 ydlcsu 于 2009-3-27 22:11 编辑 ]

评分

1

查看全部评分

 楼主| 发表于 2009-3-28 09:40 | 显示全部楼层

回复 沙发 ydlcsu 的帖子

very good! 就是这个问题,问题解决,非常感谢。非常感谢。非常感谢。
您需要登录后才可以回帖 登录 | 我要加入

本版积分规则

QQ|小黑屋|Archiver|手机版|联系我们|声振论坛

GMT+8, 2024-9-22 17:29 , Processed in 0.062897 second(s), 22 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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