How can I replace values that meet a condition when I work with matrices and structures?
Show older comments
When efSin09(ch,tt) is equal to 0, xcoord_noOverlap{tt*3-2,1}(ch,:) should become NaN. Here efSin09 is 142x16 double, xcoord_noOverlap is 48x3 cell where each cell has a different amount of rows and colums, tt = [1:16] and ch is the amount of rows for every cell of xcoord_noOverlap and therefore changes for every loop of tt but is always a positive number without decimals. I tried to do this with an if-statement, that didn't give an error, but for some reason was just ignored by Matlab. The error I get now is "Error: File: PostProcessNetwork_ver09_JoyceC.m Line: 1831 Column: 9 ()-indexing must appear last in an index expression.".
if true
% for tt = 1:NumTimesteps
for ch = 1:size(xcoord_noOverlap{tt*3-2,1},1)
xcoord_noOverlap{tt*3-2,1}(ch,:)(efSin09(ch,tt) ~= 1) = NaN;
end
end
end
Accepted Answer
More Answers (0)
Categories
Find more on Structures in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!