Help with sprintf, disp, load, strcat?
3 ビュー (過去 30 日間)
古いコメントを表示
I have this script that plots a bunch of data and sends it to excel. I'm trying to automate the script so that it gets the day's file daily and plots and saves the data. Here is the beginning of the script...
function my_Dayplot_Emissions_KW_2011_v5(FileName,PathName,flag_plots,flag_writetoexcel)
PathName =('T:\10 - VEHICLE TESTING RESULTS\2011 KENWORTH ISX15\10 - CANAPE FILES\1306\MAT_raw\');
FileName = concatdatesearch(PathName);
flag_plots = 1;
flag_writetoexcel = 1;
%****
%Nomenclature
disp(sprintf('Running Dayplot Emissions.. %s',FileName));
S=load(strcat(PathName,FileName));
S.FileName=FileName;
S.PathName=PathName;
S.t=1:length(S.CAN1_EEC1_EngSpeed); %seconds
S.mat_time=S.XCP_MatlabTime_time;
S.code_ver=4;
The concatdatesearch function is needed to get the right concat file. The function works fine. However, the script does not work when I try to set FileName equal to that function. It only works when FileName = '20130622_SPLBRENT3_concat.mat'.
The error it shows is
Error using sprintf
Function is not defined for 'cell' inputs.
Error in my_Dayplot_Emissions_KW_2011_v5 (line 95)
disp(sprintf('Running Dayplot Emissions.. %s',FileName));
However this error does not show when I run the script when FileName = '20130622_SPLBRENT3_concat.mat'. And concatdatesearch(PathName) is equal to '20130622_SPLBRENT3_concat.mat'. What am I doing wrong?
0 件のコメント
採用された回答
Kelly Kearney
2013 年 6 月 24 日
Looks like concatdatesearch returns a cell array, not a character array. Try adding the line
FileName = FileName{1};
after your call to concatdatesearch.
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Text Data Preparation についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!