看板 MATLAB 關於我們 聯絡資訊
話不多說,如下 功能:可以直接跳至當下執行檔案之目錄,並搜索此目錄下所有資料夾之m檔 好處一: 開啟main檔後,點run就能執行,而且不會問你要不要切換資料夾。 好處二: 當subfuction越寫越多,需要用到資料夾分類時,路徑不用一個一個加。 clear all; clc; Pathread = dbstack('-completenames'); filepath = Pathread.file; currentpath = filepath(1:(end-length(Pathread.name)-2)) ; cd(currentpath); addpath(genpath(pwd)); disp(['Current Directory is ' pwd]) -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 118.169.77.240