f



Matrix in a matrix?

Hi to all,

I've encountered a problem using Matlab. As I'm not very familiar
with matlab, there are functions which I have not used before.

What I would like to know, if there is a way to express a matrix
within a matrix. For example,

R= [ r1 r2 r3 ... rn]

where rn=[xn yn tn]

and xn, yn, tn are column of numbers.

I used the following code below to express the numbers in rn as
coloumns for easy referencing.

xn=r(:,1); %represents the columns in the matrix
yn=r(:,2);
tn=r(:,3);

My objective is to be able to retrieve information in the matrix
easily and compare their values. Meaning, the user will specify n and
the numbers in the columns.

thanks for the help..

Regards,

Cy
0
5/21/2007 4:28:31 AM
comp.soft-sys.matlab 211266 articles. 21 followers. lunamoonmoon (257) is leader. Post Follow

6 Replies
817 Views

Similar Articles

[PageSpeed] 24

use a strucure of arrays .. look it up in matlab help

Cheers,

Venkat

On May 21, 12:28 am, CY <ychangy...@hotmail.com> wrote:
> Hi to all,
>
> I've encountered a problem using Matlab. As I'm not very familiar
> with matlab, there are functions which I have not used before.
>
> What I would like to know, if there is a way to express a matrix
> within a matrix. For example,
>
> R= [ r1 r2 r3 ... rn]
>
> where rn=[xn yn tn]
>
> and xn, yn, tn are column of numbers.
>
> I used the following code below to express the numbers in rn as
> coloumns for easy referencing.
>
> xn=r(:,1); %represents the columns in the matrix
> yn=r(:,2);
> tn=r(:,3);
>
> My objective is to be able to retrieve information in the matrix
> easily and compare their values. Meaning, the user will specify n and
> the numbers in the columns.
>
> thanks for the help..
>
> Regards,
>
> Cy


0
dafloydian (13)
5/21/2007 4:46:21 AM
maybe the easiest way to do this is to use the cells (see: help cell).
0
mat_labor (34)
5/21/2007 6:23:16 PM
Mat wrote:
>
>
> maybe the easiest way to do this is to use the cells (see: help
> cell).
  

Dear Mat,

Thanks for your help. I was able to get the desired results. But at
the moment, I'm unable to retrieve the information that I need.

rincell =

    [101x3 double] [101x3 double]

rincell(1,1)

ans =

    [101x3 double]

I wanted to view the entire matrix in (1,1), but if gave me this
result instead. Is there a way where I can get it to display the
entire result?

Thanks!
Cy
0
5/21/2007 7:15:13 PM
See help paren.

Also, if all your columns are the same length, you may want to
consider storing your data in three matrices, for ease of reference:

X = [x1 x2 ... xn];
Y = [y1 y2 ... yn];
T = [t1 t2 ... tn];
0
5/21/2007 7:33:43 PM
....or in a 3d matrix.
0
5/21/2007 7:34:35 PM
cy wrote:
<SNIP howto get the contents of a cell

% cell
A = {1:10 ; 3 ; [ 4 5 7]} ;

b = A(1)
% versus
c = A{1} % note the curly braces!
whos

hth
Jos
0
Jos
5/21/2007 9:01:03 PM
Reply:

Similar Artilces:

Matrix of matrix
Hi everbody. First of all, I apologize for my English, so please be indulgent with me if my sentences are not grammatically correct. I have some trouble with MATLAB. I have some data in txt files that I catch like that : MFS93A1 = textread('Z:/Fichiers/MFS93.A1.txt','','headerlines',1); MFS93B1 = textread('Z:/Fichiers/MFS93.B1.txt','','headerlines',1); MFM77A1 = textread('Z:/Fichiers/MFM77.A1.txt','','headerlines',1); MFM77C1 = textread('Z:/Fichiers/MFM77.C1.txt','','headerlines',1); Then, in or...

matrix in a matrix
hallo there. I want to put a matrix that is 128X128 in a matrix that is 512X512 ( ones(512) ). what I want to do is to have the white image and above to put the second image ( a letter, A for example). I cant multiply cause they dont have the same dimensions. any ideas?? thanks in advance "th " <THOMITSU@YAHOO.COM> wrote in message <hsjabs$bbc$1@fred.mathworks.com>... > hallo there. > > I want to put a matrix that is 128X128 in a matrix that is 512X512 ( ones(512) ). > > what I want to do is to have the white image and above ...

matrix in matrix (?)
Hi, I need help! I want to construct a matrix 10x10 where every element is a matrix ?x2. After, I need to extract the ?x2 matrix by the 10x10. how to make that? mirus wrote: > Hi, I need help! > > I want to construct a matrix 10x10 where every element is a matrix > ?x2. > > After, I need to extract the ?x2 matrix by the 10x10. > > how to make that? have a look at cell arrays. they provide the possibility to store arbitrary data in an array like fashion. michael Michael Wild wrote: > mirus wrote: >> Hi, I need help! >> >> I want to constru...

matrix with matrix for each element
Hi, I am trying to create a matrix which has a matrix as each element e.g.: h=[1:3]' h(1)=[1,2;3,4] I then get this message which is understandable: ??? In an assignment A(I) = B, the number of elements in B and I must be the same. Is there a way to do this though? Thanks in advance. "Dave Brackett" <davebrackett@hotmail.com> wrote in message <g5i9f9$eoo$1@fred.mathworks.com>... > Hi, I am trying to create a matrix which has a matrix as > each element e.g.: > > h=[1:3]' > h(1)=[1,2;3,4] > > I then get this message which is understan...

Matrix in a Matrix #2
Say for instance: A = [1 2; 3 4; 5 6]; B = [2 1; 3 2; 6 5]; Is there anyway that I can say: C(1,1) = A; C(2,1) = B; etc. Or is it possible to store a matrix as a single element of another? Thanks. "Dan" <danrajjj007@hotmail.com> wrote in message news:eed05cf.-1@webx.raydaftYaTP... > Say for instance: A = [1 2; 3 4; 5 6]; > B = [2 1; 3 2; 6 5]; > > Is there anyway that I can say: > > C(1,1) = A; > C(2,1) = B; > etc. > > Or is it possible to store a matrix as a single element of another? > > Thanks. Ken Davis just answered th...

insert a matrix into matrix
hello, new to all this so excuse my ignorance lets say i have x = 1 2 3 4 which i convert to column vector x= 1 2 3 4 now i have a, created from the lengh of x in this case 4, and any value, lets say 4, so a= 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 now i want to insert x into a 4 times, so that a= 1 1 1 1 2 2 2 2 3 3 3 3 4 4 4 4 but i want to do this without a loop i can replace it with numbers using a(,:i)=x where i = 1 to 4 in this case, but i have to use a loop for that, did i explain that ok, can anyone help? cheeseboy On Fri, 19 Nov 2004 20:47:25 -0500, cheeseboy wrote: > hello...

Matrix filtering by other matrix
Hi all, I have two vectors, one with data, and one with 0 /1 values that says which items on the first vector are valid. I need to create a third vector that is built only from the valid items on the first vector. Is there a single command that does that (it's easy to do it iteratively, but I guess that the performance are bad doing it like that) thanks Yoav "Yoav Rubin" <yoavrubin@hotmail.com> wrote in message <gri62q$hhd$1@fred.mathworks.com>... > Hi all, > > I have two vectors, one with data, and one with 0 /1 values that says which items on the fi...

Matrix in a Matrix #3
So I have two questions, they aren't complicated so sorry for asking if they have been answered a lot, but the search in these forums is just awful. My first question is simple and it is just how to do an if statement that can match my string of "Y" or "N" basically i just don't know how to work with strings. My next questions is more complicated: I would like to work with matrices within matrices, by which i mean i would have a matrix A that is 2x2, but each element of A is actually a matrix, I don't know if matlab can do this, but if not, easily ...

Matrix of Matrix Names
Hello, Let's say I have two matricies: m_title=[header 1, header 2, header 3] %Matrix of string column headers m_data=[1 2 3; 4 5 6;7 8 9] %Matrix of data I want to create three matricies where the end result would be: header 1 = [1 2 3] header 2 = [4 5 6] header 3 = [7 8 9] so each value in the matrix m_title becomes the name of a matrix containing the coinciding data in the other matrix. Is this possible? Can I throw this into a for loop since it is possible that the number of columns therefore the number of final matrices may change without my prior knowledge? Thanks "Jon ...

Copy from matrix to matrix...How?
Dear friends, if the matrix U1 equal to: U1=[1,1,1,1; 0,0,0,0; 0,0,0,0 ] and the second matrix U2 equal to: U2=[0,0,0,0; 2,2,2,2; 0,0,0,0 ] how can I creat the third matrix whic is equal to: U3=[1,1,1,1; 2,2,2,2; 0,0,0,0 ] Please could you change on my code to be right? This is the code: for j=1:10 for i=1:12 U1(i,j)=U2(i,j); end end waiting for your solution.......Thanks You can just write: U3=U1+U2 alfann <alfann.net@hotmail.com> wrote in message <2072829264.305125.126762...

how to insert a matrix into a matrix
i know this might sound like a dumb question but.. i have a 5 by 1 matrix a=[1,2,3,4,5] i now have another matrix b say 5 by 5 matrix. i want a to insert matrix b into matrix a such that matrix a's 1st column still has the values 1,2,3,4,5 and the rest of the columns will have the values of matrix b. Thanks in advance "ashish mohan" wrote in message <jms2fr$sgd$1@newscl01ah.mathworks.com>... > i know this might sound like a dumb question but.. > i have a 5 by 1 matrix a=[1,2,3,4,5] > i now have another matrix b say 5 by 5 matrix. > i want a to insert ma...

indexing a matrix with a matrix
I'm trying to work out the syntax for indexing a 2D matrix with a matrix of coordinates. I know how to do the 1D version. If I have a 1D vector 'A' and a vector 'B' that contains index values; then I can do A(B) and it gives a vector the same length as 'B' with the values of 'A' that correspond to the indexes in 'B'. I can't seem to work out the 2D version. 'A' is now a 2D matrix. 'B' is now a matrix with 2 columns - 1st column is x values, second column is y values. So each row uniquely indexes a value in 'A'. But how do...

matrix of matrix #2
i have many matrixs to dispose on diagonal of a new matrix. X Y Z matrix N*M A=X Y Z can you help me please? thanks in any way Bye Imma imma wrote: > > > i have many matrixs to dispose on diagonal of a new matrix. > X Y Z matrix N*M > A=X > Y > Z > can you help me please? > thanks in any way > Bye > Imma Can you give a small example? At least, take a look at <diag> or <blkdiag> hth Jos ...

matrix selection out of other matrix
Hi, I'm currently working on some trigger data, and I've got my self te samplenumber when the trigger hits. This number is saved in a new matrix called X so X is something like this a matrix of multiple rows by 1 column 10 12 14 15 now in other data the samplenumber is the number of rows, What i want to do is to select the data by trigger sample number So A= samplenumbers 10:12 and B= 12:14 etc. i thought of somethign like A=data(x(1,1),1:x(2,1),1) Where A is new variable and Data is the selected matrix with multiple rows(20000) and 1 column X is the triggersample number Than...

Web resources about - Matrix in a matrix? - comp.soft-sys.matlab


Matrix digital rain - Wikipedia, the free encyclopedia
Matrix digital rain , Matrix code or sometimes green rain , is the computer code featured in the Matrix series . The falling green code is a ...

'Matrix' actress Essie Davis joins 'Game of Thrones'
... HBO representative didn't immediately respond to Business Insider's request for confirmation on the casting. Davis has starred in "The Matrix: ...

December 2015: Unofficial Problem Bank list declines to 250 Institutions, Q4 2015 Transition Matrix
... and State Bank of Nauvoo, Nauvoo, IL ($32 million). With it being the end of the fourth quarter, we bring an updated transition matrix to identify ...

Super Bowl special effects: New cameras power 'Matrix'-style replays
The broadcast will use a record number of cameras to capture angles that put viewers in the middle of the action.

New Film Theory Suggests Neo Isn't The One In The Matrix Trilogy
... The latest video from the Youtube channel, The Film Theorists , presents a theory that Mr. Anderson is NOT the One in the Wachowskis' The Matrix ...

Matrix-style Brain Implant Could Boost Memory
DARPA researchers want to place electrode arrays on brains to improve recall and reinforce muscle memories that don't exist.

Artificial Intelligence: What is the Matrix?
... as “dot com”. Our imaginations were running wild when at the perfect moment Warner Brothers released its science fiction classic “The Matrix”. ...

Holometer finds no evidence we’re living in a Matrix-like hologram … so far
Is our universe a two-dimensional hologram? It sounds like science fiction straight from “The Matrix,” but scientists are checking out the hypothesis ...

The Matrix Glitches as Black-and-White Comic The Walking Dead Becomes a Coloring Book
The Walking Dead comic book is a relative rarity in the world of modern, mainstream comic, as each issue is in greyscale, rather than the normal ...

Building the Infinite Matrix of Tamagotchis
... is also something of an Architect, and like all Architects he only wants what is best for the system he created. In this case, it’s a Matrix ...

Resources last updated: 2/12/2016 6:45:21 AM