cell into a cell

조회 수: 3 (최근 30일)
Richard
Richard 2012년 1월 16일
I have a 1x3 cell called 'Data' where each of the cells are made up of a 2x1 cell. I want to combine 'Data' with another 1x3 cell called 'Named'. I basically want 'Data' to be cells within the cells in 'Named'. So in the command window you will have a 1x3 cell called 'Named' then by clicking on this variable you will then get the 1x3 cell originally in 'Named' then by clicking on the appropriate cell you will get the relevant 2x1 cell which was originally in 'Data'.
If this isn't clear enough i'll attempt to make an idealised example to make it clearer.
  댓글 수: 4
Walter Roberson
Walter Roberson 2012년 1월 16일
I think I've said that ;-)
Richard
Richard 2012년 1월 16일
example below :)

댓글을 달려면 로그인하십시오.

채택된 답변

Titus Edelhofer
Titus Edelhofer 2012년 1월 16일
This sounds more like a struct?
for i=1:3
for j=1:2
TXT.(Name{i}){j,1} = rand(12);
end
end
Or use cell2struct to do this afterwards ... ??
Titus
  댓글 수: 1
Richard
Richard 2012년 1월 16일
perfect

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Titus Edelhofer
Titus Edelhofer 2012년 1월 16일
Hi,
I guess
Named(1:3) = {Data};
is too simple?
Titus
  댓글 수: 2
Richard
Richard 2012년 1월 16일
Yes, thats not what i'm looking for. I'll try and come up with an example
Richard
Richard 2012년 1월 16일
example:
for i=1:3;
for j=1:2;
TXT{1,i}{j,1}=(rand(12,12));
end;
end;
Name={'help','me','please'};
Instead of having each cell in 'TXT' named according to the number of cells inside (i.e. 2x1 cell) I would like each of the cells to be named according to each cell in 'Name'. I hope this is straight forward enough.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by