| 4 | 1/1 | 返回列表 |
| 查看: 1191 | 回復(fù): 3 | |||
[求助]
matlab調(diào)試問題
|
|
用matlab將.car文件轉(zhuǎn)換為lammps的data文件時總是報錯 運(yùn)行到:[~,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源文件運(yùn)行時沒有問題,[~,x,y,z,~,element1,perx,pery,perz,charge] = read_msi_file(filename);這句話中的標(biāo)點也都是英文符號下的 實在不知道錯誤在哪 請各位高手幫幫忙~~ |

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


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

| 4 | 1/1 | 返回列表 |
| 最具人氣熱帖推薦 [查看全部] | 作者 | 回/看 | 最后發(fā)表 | |
|---|---|---|---|---|
|
[考研] 0817 化學(xué)工程 299分求調(diào)劑 有科研經(jīng)歷 有二區(qū)文章 +9 | rare12345 2026-03-18 | 9/450 |
|
|---|---|---|---|---|
|
[考研] 0703化學(xué) 305求調(diào)劑 +4 | FY_yy 2026-03-14 | 4/200 |
|
|
[考研]
|
.6lL 2026-03-18 | 5/250 |
|
|
[考研] 286求調(diào)劑 +6 | lemonzzn 2026-03-16 | 9/450 |
|
|
[考研] 收復(fù)試調(diào)劑生 +4 | 雨后秋荷 2026-03-18 | 4/200 |
|
|
[考研] 280求調(diào)劑 +6 | 咕嚕曉曉 2026-03-18 | 7/350 |
|
|
[考研] 材料,紡織,生物(0856、0710),化學(xué)招生啦 +3 | Eember. 2026-03-17 | 9/450 |
|
|
[考研] 生物學(xué)071000 329分求調(diào)劑 +3 | 我愛生物生物愛?/a> 2026-03-17 | 3/150 |
|
|
[考研] 考研求調(diào)劑 +3 | 橘頌. 2026-03-17 | 4/200 |
|
|
[考研] 考研化學(xué)學(xué)碩調(diào)劑,一志愿985 +4 | 張vvvv 2026-03-15 | 6/300 |
|
|
[考研] 085600材料與化工求調(diào)劑 +5 | 緒幸與子 2026-03-17 | 5/250 |
|
|
[考研] 有沒有道鐵/土木的想調(diào)劑南林,給自己招師弟中~ +3 | TqlXswl 2026-03-16 | 7/350 |
|
|
[論文投稿] 有沒有大佬發(fā)小論文能帶我個二作 +3 | 增銳漏人 2026-03-17 | 4/200 |
|
|
[考研] 333求調(diào)劑 +3 | 文思客 2026-03-16 | 7/350 |
|
|
[考研] 0856求調(diào)劑 +3 | 劉夢微 2026-03-15 | 3/150 |
|
|
[考研] 中科大材料專碩319求調(diào)劑 +3 | 孟鑫材料 2026-03-13 | 3/150 |
|
|
[考研] 學(xué)碩285求調(diào)劑 +13 | Wisjxn 2026-03-12 | 46/2300 |
|
|
[考研] 330求調(diào)劑 +3 | ?醬給調(diào)劑跪了 2026-03-13 | 3/150 |
|
|
[考研] 329求調(diào)劑 +3 | miaodesi 2026-03-12 | 4/200 |
|
|
[考研] 工科材料085601 279求調(diào)劑 +8 | 困于星晨 2026-03-12 | 10/500 |
|