Sign in

username:

password:



Not a member?

Search matlab



Search tips

Subscribe to matlab



matlab by Keywords

Atanh | Autocorrelation | Bandpass Filter | C++ | Conv | Database | Deconv | Excel | FFT | Filter | Filtering | FIR | Fourier Transfrom | FSK | Gaussian Noise | Haykin | IFFT | Image | Java | LFSR | LMS | LPC | MEX | OFDM | QPSK | Radix | Random | Sampling | Segmentation | Simulink | Visual Basic | Waveform | Wavelet

Ads

Discussion Groups

Discussion Groups | Matlab DSP | Serious Help needed in Matlab programming

Technical discussion about Matlab and issues related to Digital Signal Processing.

  

Post a new Thread

Serious Help needed in Matlab programming - jain_nisha61 - Jul 11 8:21:42 2008



Hi All,

I need some serious help i am suffering from a issue from long time i 
need to following to accomplish

array1 [ ['ajhhdeu'] ['heihi']]
         ['hewrh ']   [] 
the above is array1 
and some array2 is as follows 

   ['fiee'] ['jj']
   ['pp']   ['dd']
now i need array in following manner 

[ ['ajhhdeu'] ['fiee'] ]   [ ['heihi'] ['jj'] ] 

etc.. The moral of story is i need to have a final array which gives 
each first row first column of both arrays and form a new array so 
that i can index them but if there is some [] empty element of array 
i want to ignore that so my final array should be 

1x2 1x2 
1x2 1x1 

here how should i do this ? 
Also if i want to index individually each cell i should be able to do 
so...

Please if any one has some idea let me know i am trying very hard to 
do it from past one week and my whole progrmmaing is inhault in one 
mannar.....

Please also I checked following functions --- horizontalcat, strcat, 
putting crazily for loops etc...

My real matrices for the input are as follows and i am generating 
some equations actually combinations of various strings 
L2Constraint(:,:,1) = 

    '2 * x2111'             []    '5 * x2123'
    '2 * x3211'    '5 * x1222'    '5 * x3223'
             []    '2 * x2312'             []
L2Constraint(:,:,2) = 

    '1 * x2131'             []     []
             []    '1 * x3232'     []
             []             []     []
L2Constraint(:,:,3) = 

     []             []     []
     []    '1 * x4232'     []
     []             []     []

In above case i need to have all combinations of the variable strings 
so i need to merge them all in such a manner that i skip empty 
variables but still able index each one seperately...

Final should look like this

L2Constraint = 

  {'2 * x2111' '1 * x2131'}    []                          '5 * x2123'
    '2 * x3211'               {'5 * x1222','1 * x3232'     '5 * x3223'
                               ,'1 * x4232' }
             []                '2 * x2312'                 []
Is it possible first of all???

Thanks and Regards,
Nisha


(You need to be a member of matlab -- send a blank email to matlab-subscribe@yahoogroups.com )

Re: Serious Help needed in Matlab programming - Dev Roy - Jul 11 15:01:53 2008


Hi Nisha,

 

Well regarding all these array manipulations the most
powerful  function is “reshape”

 

Now for your problem , it took me sometime tho to understand
ur problem and
implement  ,anyways :)

 

Ok, with the two dimensional array L2Constraint( :,:,1) and
L2Constraint( :,:,2), I think I have understood how to deal but with the
addition of L2Constraint( :,:,3), the result you want i.e. L2Constraint = 

{'2 * x2111' '1 * x2131'} [] '5 * x2123'

'2 * x3211' {'5 * x1222','1 * x3232' '5 * x3223'

,'1 * x4232' }

[] '2 * x2312' []

 

This I could not figure out how exactly do u need to arrange
the elements of these three arrays simultaneously , so I have just assumed that
u have two arrays L2Constraint( :,:,1) and L2Constraint( :,:,2). The code :

 

close all;clear all;clc

%-------------------------

aa1=[cellstr('2 * x2111') cellstr('') cellstr('5 * x2123')];

aa2=[cellstr('2 * x3211') cellstr('5 * x1222') cellstr('5 * x3223')];

aa3=[cellstr('') cellstr('2 * x2312') cellstr('')];

a(:,:,1)=[aa1;aa2;aa3];

%------------------------

aa1=[cellstr('1 * x2131') cellstr('') cellstr('')];

aa2=[cellstr('') cellstr('1 * x3232') cellstr('')];

aa3=[cellstr('') cellstr('') cellstr('')];

a(:,:,2)=[aa1;aa2;aa3];

%------------------------

aa1=[cellstr('') cellstr('') cellstr('')];

aa2=[cellstr('') cellstr('1 * x4232') cellstr('')];

aa3=[cellstr('') cellstr('') cellstr('')];

a(:,:,3)=[aa1;aa2;aa3];

%----------------------------

b1=[a(1,:,1);a(1,:,2)]

ass1=reshape(b1,1,6)

b2=[a(2,:,1);a(2,:,2)]

ass2=reshape(b2,1,6)

b3=[a(3,:,1);a(3,:,2)]

ass3=reshape(b3,1,6)

ass=[ass1;ass2;ass3]

 

 

Let me know in what other ways u need ur results to be or if
u can clarify more about the 3rd dimension thing, that how u want
its elements to be inserted in the final array, or just anything else u want to
know J

 

Hope it helps

Cheers

 

- Dev

--- On Fri, 7/11/08, jain_nisha61 <j...@yahoo.com> wrote:
From: jain_nisha61 <j...@yahoo.com>
Subject: [matlab] Serious Help needed in Matlab programming
To: m...@yahoogroups.com
Date: Friday, July 11, 2008, 8:21 AM

            Hi All,

I need some serious help i am suffering from a issue from long time i 

need to following to accomplish

array1 [ ['ajhhdeu'] ['heihi']]

         ['hewrh ']   [] 

the above is array1 

and some array2 is as follows 

['fiee'] ['jj']

   ['pp']   ['dd']

now i need array in following manner 

[ ['ajhhdeu'] ['fiee'] ]   [ ['heihi'] ['jj'] ] 

etc.. The moral of story is i need to have a final array which gives 

each first row first column of both arrays and form a new array so 

that i can index them but if there is some [] empty element of array 

i want to ignore that so my final array should be 

1x2 1x2 

1x2 1x1 

here how should i do this ? 

Also if i want to index individually each cell i should be able to do 

so...

Please if any one has some idea let me know i am trying very hard to 

do it from past one week and my whole progrmmaing is inhault in one 

mannar.....

Please also I checked following functions --- horizontalcat, strcat, 

putting crazily for loops etc...

My real matrices for the input are as follows and i am generating 

some equations actually combinations of various strings 

L2Constraint( :,:,1) = 

'2 * x2111'             []    '5 * x2123'

    '2 * x3211'    '5 * x1222'    '5 * x3223'

             []    '2 * x2312'             []

L2Constraint( :,:,2) = 

'1 * x2131'             []     []

             []    '1 * x3232'     []

             []             []     []

L2Constraint( :,:,3) = 

[]             []     []

     []    '1 * x4232'     []

     []             []     []

In above case i need to have all combinations of the variable strings 

so i need to merge them all in such a manner that i skip empty 

variables but still able index each one seperately.. .

Final should look like this

L2Constraint = 

{'2 * x2111' '1 * x2131'}    []                          '5 * x2123'

    '2 * x3211'               {'5 * x1222','1 * x3232'     '5 * x3223'

                               ,'1 * x4232' }

             []                '2 * x2312'                 []

Is it possible first of all???

Thanks and Regards,

Nisha



(You need to be a member of matlab -- send a blank email to matlab-subscribe@yahoogroups.com )