| 5 | 1/1 | 返回列表 |
| 查看: 1212 | 回復: 3 | |||
| 當前只顯示滿足指定條件的回帖,點擊這里查看本話題的所有回帖 | |||
[求助]
matlab調(diào)試問題
|
|||
|
用matlab將.car文件轉(zhuǎn)換為lammps的data文件時總是報錯 運行到:[~,x,y,z,~,element1,perx,pery,perz,charge] = read_msi_file(filename); 報錯:??? [~,x,y,z,~,element1,perx,pery,perz,charge] = read_msi_file(filename); | Error: Expression or statement is incorrect--possibly unbalanced (, {, or [. read_msi_file源文件如下:function [ID,x,y,z,monomer,element,perx,pery,perz,charge] = read_msi_file(filename) %filename = 'poly.car'; fid = fopen(filename); % read the file header header.line1 = fgetl(fid); header.line2 = fgetl(fid); header.line3 = fgetl(fid); header.line4 = fgetl(fid); % Get the periodic boundary lengths tline = fgetl(fid); text_format='%*s %f %f %f %*f %*f %*f %*s'; clear C C = textscan(tline, text_format, 1);%第5行 C[1]~C[3] perx = C{1}; pery = C{2}; perz = C{3}; % Output parameters into element for element 'ename' tline = fgetl(fid);%第六行 continue_loop = 1; count = 0; while continue_loop text_format='%s %f %f %f %s %u %s %s %f'; clear C C = textscan(tline, text_format, 1);%C[1]~C[9] count = count + 1; ID{count} = C{1}; x(count) = C{2};%double y(count) = C{3}; z(count) = C{4}; monomer(count) = C{6};%單元結(jié)構(gòu)unit32 element{count} = C{8}; charge(count) = C{9}; tline = fgetl(fid); matches = strfind(tline, 'end'); num = length(matches); if num > 0 && matches == 1 tline = fgetl(fid); matches = strfind(tline, 'end'); num = length(matches); if num > 0 && matches == 1 continue_loop = 0; end end end fclose(fid); end read_msi_file源文件運行時沒有問題,[~,x,y,z,~,element1,perx,pery,perz,charge] = read_msi_file(filename);這句話中的標點也都是英文符號下的 實在不知道錯誤在哪 請各位高手幫幫忙~~ |

榮譽版主 (著名寫手)
彩色掛圖
![]() |
專家經(jīng)驗: +2 |

榮譽版主 (著名寫手)
彩色掛圖
![]() |
專家經(jīng)驗: +2 |


| 最具人氣熱帖推薦 [查看全部] | 作者 | 回/看 | 最后發(fā)表 | |
|---|---|---|---|---|
|
[考研] 調(diào)劑 +4 | 好好讀書。 2026-03-28 | 6/300 |
|
|---|---|---|---|---|
|
[論文投稿]
chinese chemical letters英文版投稿求助
130+4
|
Yishengeryi 2026-03-30 | 4/200 |
|
|
[考研] 安徽大學專碩生物與醫(yī)藥專業(yè)(086000)324分,英語已過四六級,六級521,求調(diào)劑 +10 | 美味可樂雞翅 2026-03-26 | 11/550 |
|
|
[考研] 085600 一志愿9 總分351 求調(diào)劑學校 +7 | czhcz 2026-03-31 | 7/350 |
|
|
[考研] 299求調(diào)劑 +8 | 嗯嗯嗯嗯2 2026-03-27 | 8/400 |
|
|
[考研] 311求調(diào)劑 +7 | 李芷新1 2026-03-31 | 7/350 |
|
|
[考研] 生醫(yī)工0831調(diào)劑求推薦 +4 | 小熊睿睿_s 2026-03-27 | 6/300 |
|
|
[基金申請] 面上5B能上會嗎? +8 | redcom 2026-03-29 | 8/400 |
|
|
[考研] 347求調(diào)劑 +11 | 山頂見α 2026-03-25 | 11/550 |
|
|
[考研] 一志愿北化085600材料專碩275|有文章專利|求調(diào)劑 +15 | Micky11223 2026-03-25 | 16/800 |
|
|
[考研] 085600,專業(yè)課化工原理,320分求調(diào)劑 +6 | 大饞小子 2026-03-29 | 6/300 |
|
|
[考研] 327求調(diào)劑 +5 | 小卡不卡. 2026-03-29 | 5/250 |
|
|
[考研] 303求調(diào)劑 +7 | DLkz1314. 2026-03-30 | 7/350 |
|
|
[考研] 296求調(diào)劑 +10 | 彼岸t 2026-03-29 | 10/500 |
|
|
[考研] 349求調(diào)劑 +6 | 李木子啊哈哈 2026-03-25 | 6/300 |
|
|
[考研] 本科新能源科學與工程,一志愿華理能動285求調(diào)劑 +7 | AZMK 2026-03-28 | 11/550 |
|
|
[考研] 求調(diào)劑 +6 | 蘆lty 2026-03-25 | 7/350 |
|
|
[考研] 331環(huán)境科學與工程求調(diào)劑 +3 | 熠然好運氣 2026-03-27 | 3/150 |
|
|
[考研] 070300化學求調(diào)劑 +4 | 起個名咋這么難 2026-03-27 | 4/200 |
|
|
[考研] 303求調(diào)劑 +6 | 藍山月 2026-03-25 | 6/300 |
|