[問題] function無法使用~怪了~"~已回收

看板MATLAB作者 (此ID停止使用)時間17年前 (2008/10/24 17:14), 編輯推噓0(001)
留言1則, 1人參與, 最新討論串1/1
如果meanS2>meanS1..我就會跳到function 去把該檔案的名稱記錄下來 可是似乎都不成功..都出現 ??? Undefined function or method 'warn' for input arguments of type 'char'. 可以請教是哪邊出錯嗎??..而且光是在M-file的function那邊就出現~~~的紅色底線 我的程式碼: fid = fopen('filelist2.txt','r'); AllName = textscan(fid, '%s'); files = strvcat(AllName{1}); fclose(fid); Nfile = size(files,1); % Then set up a for loop to get the name of the files, one at a time for i = 1:Nfile filenow = deblank(files(i,:)); filenow1=['DATA1\' filenow] S = netcdf(filenow1); MSL_alt = S.VarArray(1).Data; GEO_lat = S.VarArray(2).Data; GEO_lon = S.VarArray(3).Data; OCC_azi = S.VarArray(4).Data; TEC_cal = S.VarArray(5).Data; ELEC_dens = S.VarArray(6).Data; idx1=find(MSL_alt>=500 & MSL_alt<=600); n1=length(idx1); if n1~=0 ELEC_dens1=ELEC_dens(idx1(1):idx1(end)); MSL_alt1=MSL_alt(idx1(1):idx1(end)); S1=sum(ELEC_dens1); N1=length(MSL_alt1); meanS1=S1/N1; idx2=find(MSL_alt>=600 & MSL_alt<=700); n2=length(idx2); if n2~=0 ELEC_dens2=ELEC_dens(idx2(1):idx2(end)); MSL_alt2=MSL_alt(idx2(1):idx2(end)); S2=sum(ELEC_dens2); N2=length(MSL_alt2); meanS2=S2/N2; abnorm=meanS2>meanS1; if (abnorm) warn(filenow); end end end end function warn(filenow) ionwarn=filenow; ionwarn1=['Ion_warn1.txt']; dlmwrite(ionwarn1,ionwarn,'precision','%f','delimiter','','-append','newline','pc'); ================================================================== 感激 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.116.45.92

10/24 18:02, , 1F
OK了~再多寫一個m-file~~解決
10/24 18:02, 1F
文章代碼(AID): #190P7XRb (MATLAB)
文章代碼(AID): #190P7XRb (MATLAB)