查看单个帖子
旧 2012-06-07, 16:54   #1
byron
初级会员
 
注册日期: 2012-06-06
帖子: 2
声望力: 0
byron 正向着好的方向发展
默认 不明错误,结构体到变量,怎么转换?

如下,file为一个结构体,包含文件名字等创立信息,

现在我只需要结构体file中的name,讲name和ctext1进行对比(ctext1是一个读取的字符串变量),

运行的结果是Error in ==> if ctext1==logname,Matrix dimensions must agree.

但是当我将第三行括号里的(nf),直接写成(1)后,就运行正常了,这是为什么?请问怎么改?


file=dir('*.las');
for nf=1:length(file)
logname=file(nf).name
if ctext1==logname


请问怎么修改?才能通过呢?我需要的是循环能通过。
byron 当前离线   回复时引用此帖