[問題] 自訂函數的問題已回收

看板MATLAB作者 (不受愛眷顧的人)時間15年前 (2010/04/12 00:03), 編輯推噓1(103)
留言4則, 4人參與, 最新討論串1/1
在同一個資料夾下 設了兩個m file 分別是main和rms_in 其中rms_in試當作自訂function ====main==== clc; clear; close all; tic; x=(0.1:0.1:20); rms_out=rms_in(x); plot(1:20,rms20out),grid; ============ ===rms_in=== function rsm_out=rsm_in(x) rsm_out=ones(20); for i=0:19 p=[x(0:(1+i*10))]; ssum=0; for j=1:10 sq=p(j).*p(j); ssum=ssum+sq; end rsm_out(i+1)=ssum^0.5; end ============ 執行main都是error Undefined command/function 'rms_in'. 爬文說當兩個檔案在同一個資料夾就可 可是還是無法解決 請問有大大能幫忙看看嗎 -- 需要的不只是機會,還有勇氣... -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 220.131.67.173 ※ 編輯: etisme 來自: 220.131.67.173 (04/12 00:04)

04/12 00:11, , 1F
檔名rms_in 函式名卻是rsm_in 不一致是不行的
04/12 00:11, 1F

04/12 00:11, , 2F
改變工作資料夾 ?
04/12 00:11, 2F

04/12 01:09, , 3F
1F正解 看要改檔名還是改function rsm_out=rms_in(x)
04/12 01:09, 3F

04/12 02:19, , 4F
已解決,謝謝!
04/12 02:19, 4F
文章代碼(AID): #1BmVB8z8 (MATLAB)