フィルターのクリア

Info

この質問は閉じられています。 編集または回答するには再度開いてください。

largr txt file to matrix extraction in matlab

1 回表示 (過去 30 日間)
Kamal Bera
Kamal Bera 2015 年 4 月 15 日
コメント済み: Kamal Bera 2015 年 5 月 6 日
Hi Mr. Stephen Cobeldick, I am trying to apply your code (see below )to get a matrix of size 1710x1710 from a txt file (attached) as I did earlier to get 6x6 and 18x18 matrices from txt files. Unfortunately it is not working and shows error as
Subscripted assignment dimension mismatch.
Error in KSUBmatrix (line 9)
out(k,:) = val{k}(:,2);
Kindly help me so that I can apply the code for any matrix dimension I wish to extract.It is urgently required.
str = fileread('STIFFNESS MATRIX .txt'); % txt file name STIFFNESS MATRIX extracted from ANSYS
[tok,idx] = regexp(str,'ROW\s+(\d+)\s+NODE\s+(\d+)\s+[^\n=]+=\s+(\w+)','tokens','end');
tok = vertcat(tok{:});
idx = [1+idx,numel(str)];
fun = @(b,e)reshape(sscanf(str(b:e),'%f'),2,[]).';
val = arrayfun(fun,idx(1:end-1),idx(2:end),'UniformOutput',false);
out = zeros(numel(val));
for k = 1:numel(val)
out(k,:) = val{k}(:,2);
end
K=out; % required structural stiffness matrix
The file attached is in zip form as it is of large size. If you required the file corresponding to 6x6 or 18x18 matrix cases(for which the given code works nicely), I will attach those separately.
I am egerly waiting for your quick response.
thank you.
  6 件のコメント
Kamal Bera
Kamal Bera 2015 年 5 月 6 日
sorry. wiil not be repeated in future.

回答 (0 件)

この質問は閉じられています。

Community Treasure Hunt

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

Start Hunting!

Translated by