How do I read the number of nodes from a ssc file?

2 ビュー (過去 30 日間)
Debarsi Chakraborty
Debarsi Chakraborty 2019 年 6 月 15 日
編集済み: Debarsi Chakraborty 2019 年 6 月 29 日
I have a ssc file. The contents of the file is below.
component BSC019N02KS
nodes
drain = foundation.electrical.electrical; % drain
gate = foundation.electrical.electrical; % gate
source = foundation.electrical.electrical; % source
tj = foundation.electrical.electrical; % tj
tcase = foundation.electrical.electrical; % tcase
end
nodes(Access=protected, ExternalAccess=none)
d1 = foundation.electrical.electrical;
g = foundation.electrical.electrical;
s = foundation.electrical.electrical;
g1 = foundation.electrical.electrical;
s1 = foundation.electrical.electrical;
d2 = foundation.electrical.electrical;
t1 = foundation.electrical.electrical;
t2 = foundation.electrical.electrical;
t3 = foundation.electrical.electrical;
t4 = foundation.electrical.electrical;
end
In this case the number of nodes are 5 . (drain, gate, source, tj and tcase). How do I get the number of nodes with the help of a matlab code?

採用された回答

Walter Roberson
Walter Roberson 2019 年 6 月 15 日
S = fileread('BSC019N02KS.ssc');
nodelines = regexp(regexp(S,'nodes.*?end','match','once'),'\r?\n','split');
if isempty(nodelines)
numnodes = 0;
else
numnodes = length(nodelines) - 2;
end

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeRun Unit Tests についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by