我試圖在執行 git 命令函式后得到結果,該函式 !git config --global user.name在我的 MATLAB 的命令提示符中輸出我的用戶名。
現在,如果我將其分配給一個變數以在另一個實體中使用它,我將收到以下錯誤,如下所示。
userName = !git config --global user.name
Error : Parse error at !git config --global user.name : Usage might be invalid MATLAB syntax
disp(userName);
uj5u.com熱心網友回復:
您將需要類似的東西
[~, out.git_hash] = system('git rev-parse --verify HEAD');
[~, out.git_status] = system('git --no-pager diff --no-color');
等等
在 Windows 上,根據設定期間的不同選項,您可能需要提供 git 二進制檔案的完整路徑,例如
[~, out.git_hash] = system('"C:/Program Files/Git/mingw64/bin/git" rev-parse --verify HEAD');
[~, out.git_status] = system('"C:/Program Files/Git/mingw64/bin/git" --no-pager diff --no-color');
請注意與尋呼機相關的引數。
轉載請註明出處,本文鏈接:https://www.uj5u.com/ruanti/531268.html
標籤:混帐matlab
