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:
making unity entry in cell array

Subject: making unity entry in cell array

From: Nur Nazurah

Date: 10 Feb, 2012 04:10:27

Message: 1 of 1

I want to produce a cell array as below in matlab:

P= {100 {100 {100 {000 {000 {000
       010 000 000 100 100 000
       000 010 000 010 000 100
       000 000 010 000 010 010
       001} 001} 001} 001} 001} 001}

where P= {5x3 cell} {5x3 cell} {5x3 cell} {5x3 cell} {5x3 cell} {5x3 cell};

from the 5x3 matrix, the pattern should be unity entry in each column and the third column,final row is '1' in every cell.

how should I do that?

From what I had made up till now:

PP=zeros(5,3);
P={1,6};
P={PP,PP,PP,PP,PP,PP};
how can I put the PP with values given above in the cell?

thank you so much

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