How to reference multiple matrices in cell arrays using a colon or other special characters rather than a loop?
Show older comments
Is there a way to pull values from multiple arrays without using loops? Specifically, I would like to achieve something like this:
for i = 1:5
for j = 1:3
new{i,j} = a1{i,j}./a2{i,j};
end
end
by doing something simpler and faster like:
new{:,:} = a1{:,:}./a2{:,:};
but this kicks back an error. Assuming all the cell arrays hold appropriately sized matrices, is a loop my only option for this?
Accepted Answer
More Answers (0)
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!