预期的输入是以下类型之一:char而不是它的类型是struct

时间:2016-03-28 22:43:57

标签: matlab

我已经获得了有关此代码的帮助,但编译代码时似乎出现了错误。

function search;

Videoinfo = dir('*videotest.avi');

File = {Videoinfo};

nfiles = length(File);

if nfiles == 0
  error('No avi files available in this directory');
end
for objnum = 1 : nfiles
  videoobjs(objnum) = VideoReader(File{objnum});
end
outobj = VideoWriter('newvideo.avi');
open(outobj);

while true
  someleft = arrayfun(@hasFrame, videoobjs);

  if ~all(someleft); break; end

  for objnum = 1 : nfiles

     thisframe(:,:,:,objnum) = readFrame(videoobjs(objnum));

     meanframe = mean(thisframe, 4);

     writeVideo(outobj, meanframe);

   end

 end

close(outobj);

for objnum = 1 : nfiles
  close(videoobjs(objnum));
end
end

运行程序时出现以下错误:

"Expected input to be one of these types:
char
Instead its type was struct."

可能出现什么问题?

1 个答案:

答案 0 :(得分:0)

直接问题是因为变量SELECT SUM(hours) as total_hours, SUM(drive_time), weeks FROM ( SELECT tm_hours AS hours, SUM(drive_time) AS drive_time, STR_TO_DATE(CONCAT(YEAR(tm_date), WEEK(tm_date),' Monday'), '%X%V %W') AS weeks, bhds_timecard.case_no FROM `bhds_timecard` LEFT JOIN bhds_mileage ON bhds_timecard.case_no = bhds_mileage.case_no WHERE bhds_timecard.ds_id = '3' AND tm_date BETWEEN '2016-03-16' AND '2016-03-31' GROUP BY weeks, bhds_timecard.case_no ) as innersums GROUP by weeks; (从errorClass {error: 403, reason: "Permission denied. You need to be an admin to impersonate users.", details: undefined, message: "Permission denied. You need to be an admin to impersonate users. [403]", errorType: "Meteor.Error"} details : undefined error : 403 errorType : "Meteor.Error" message : "Permission denied. You need to be an admin to impersonate users. [403]" reason : "Permission denied. You need to be an admin to impersonate users." stack : (...) get stack : get stack() set stack : set stack() __proto__ : Error 返回)是VideoInfo 而不是字符串的单元格数组。因此,您需要引用生成的dir的{​​{1}}字段来访问文件名。

最简单的选择(以及您想要的似乎是)将struct设置为所有文件名的列表

name