필터 지우기
필터 지우기

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