I've been stuck for weeks on a code that I have been generating for image processing. And made an example of what I need. I have this code: (BTW Im new to this matlab world)(adsbygoogle = window.adsbygoogle || []).push({});

A = [2, 5, 6; 3,6,7];

B = [5, 3, 1; 7,3,2];

for i=1:3

v = genvarname('C', who);

eval([v '= A-B'])

end

The part above ^^^^ gives me this:

C =

-3 2 5

-4 3 5

C1 =

-3 2 5

-4 3 5

C2 =

-3 2 5

-4 3 5

This is the part im having problem explaining.

I want to do something like this:

for n=1:3

F{n} = C{n}(2,1) + B(2,1)

end

But it tells me:

Cell contents reference from a non-cell array object.

I really dont know what to do. Can someone help me?

**Physics Forums - The Fusion of Science and Community**

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# Matlab Problem with loops and genvarname

Loading...

Similar Threads - Matlab Problem loops | Date |
---|---|

Does anyone had this plotting problem with MATLAB? | Dec 23, 2017 |

Problems integrating in a for loop in Matlab | Dec 30, 2011 |

Problem with Matlab LOOPs | Dec 6, 2010 |

Matlab, for loop simple division problem | Apr 16, 2009 |

Matlab - I am having problems with iteration (loops) | Jan 11, 2007 |

**Physics Forums - The Fusion of Science and Community**