how to make sure columns and rows are included in loops?
1 view (last 30 days)
Show older comments
Annabel Murley
on 25 Mar 2019
Commented: Annabel Murley
on 26 Mar 2019
I have 3 531 x 500 matrices (wb2,ws2 and hh1) which I am trying to substitute into an equation. Using the following code, I am able to create a 531 x 500 matrix as desired, however all the values are 0, apart from the first which is 500. (the first 'if' loop is there to define the size of the matrices.)
does anyone know how to make sure that this equation is being applied to every number in each row and column?
if ismatrix(hh1)
[ii,jj] = size(hh1)
end
for qb=[ii,jj]
qb(ii,jj)=(hh1(ii,jj)/2)*((ws2(ii.jj)/0.025)+(wb2(ii,jj)/0.025))
end
0 Comments
Accepted Answer
Image Analyst
on 25 Mar 2019
Try this:
qb = (hh1 / 2) .* (ws2 + wb2)/0.025
Get rid of everything else you had.
More Answers (0)
See Also
Categories
Find more on Matrix Indexing 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!