Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Changing matrices in cell arrays except for one cell array in a cell

Subject: Changing matrices in cell arrays except for one cell array in a cell

From: Diego Zegarra

Date: 17 Oct, 2008 06:27:03

Message: 1 of 3

Hey guys I need your help once again! I hope someone can show me how to do this. So I have a cell MTT with "d" cell arrays in it, each cell array contains a matrix of nxn and I need to change a whole row of numbers to Inf in every matrix except for one of them which is going to be given by variable "b". MP is a matrix with a dx2 dimension. Here is my code but this will do it for all matrices, I want to find a way to not do it for "b",

    for d = 1:numMachines;
        MTT{d}(MP(b,2),:) = Inf;
    end

Now I have tried doing the following but I guess I can not do this in MatLab,

    for d = 1:numMachines && d ~= b;
        MTT{d}(MP(b,2),:) = Inf;
    end

Thanks for any help that is given! I hope I made myself clear with my explanation.

Subject: Changing matrices in cell arrays except for one cell array in a cell

From: Bruno Luong

Date: 17 Oct, 2008 06:39:02

Message: 2 of 3

"Diego Zegarra" <diegozbb@gmail.com> wrote in message <gd9b7n$qq7$1@fred.mathworks.com>...
>
>
> for d = 1:numMachines && d ~= b;

for d = [1:b-1 b+1:numMachines] % ...

Bruno

Subject: Changing matrices in cell arrays except for one cell array in a cell

From: Diego Zegarra

Date: 17 Oct, 2008 06:52:02

Message: 3 of 3

Thanks Bruno worked perfectly! I was thinking something like that but with two for loops, I did not know you could define d like that! Thanks again!

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us