필터 지우기
필터 지우기

How to set a marker in a matrix?

조회 수: 1 (최근 30일)
Calvin Koh
Calvin Koh 2018년 10월 15일
Dear all
#1,#2,#3 are just numbers.
I have created a 3D cell matrix(300,300,300) and what my script does is that it will read a number of tab delimited text files. fscanf was use to read each line and each line have information of #1,#2,#3 and position x,y,z for the matrix.
It will then go to the position in the 3D cell matrix (x,y,z) and add #2 and #3 to the existing # in that position(x,y,z) in column 1 and 2. If the cell is empty, it will append to it.
After reading the whole file, some positions in the matrix will have a variable while some are still empty depending on the information from the textfile. The next step of the script would be to perform some calculation using #2 and #3 to obtain #4 and input to column 3 at the positions where information was added to.
A simple way would be to do 3 for loops that loop through position x,y,z for all cell in the matrix.
for i = 1:300
for j = 1:300
for k = 1:300
% Calculate #4 if information is added in this position
end
end
end
But this would be very time consuming, is there a way simpler way or how can a marker be set in which information has been introduced to the position?
Thank you in advance!

답변 (0개)

카테고리

Help CenterFile Exchange에서 Text Files에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by