How to set a marker in a matrix?
1 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Cell Arrays 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!