f



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 order to do a same operation on these files, I create this matrix which contains the names of the matrix above : 

Noms_matrices = ['MFS93A1';'MFS93B1';'MFM77A1';'MFM77C1']

Then, with an instruction like this one : 

for i=1:4
    temp=eval(Noms_matrices(i,:))
end

I can get the data in all the files.

My problem is that I can't add a column of data in all these files. When I try to do eval(Noms_matrices(i,:)= something, I have the following error : 
??? Unable to find subsindex function for class char 

Is there someone who could help me ?
Thanks
Rodrigão
0
3/23/2006 4:21:43 PM
comp.soft-sys.matlab 211266 articles. 19 followers. lunamoonmoon (257) is leader. Post Follow

1 Replies
647 Views

Similar Articles

[PageSpeed] 39

try this:

eval(sprintf('%s(i,:)=something;',Noms_matrices(i,:))


"Pierrick JOUBERT" <pierrick.joubert@gmail.com> wrote in message 
news:20864866.1143120134124.JavaMail.jakarta@nitrogen.mathforum.org...
> 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 order to do a same operation on these files, I create this matrix 
> which contains the names of the matrix above :
>
> Noms_matrices = ['MFS93A1';'MFS93B1';'MFM77A1';'MFM77C1']
>
> Then, with an instruction like this one :
>
> for i=1:4
>    temp=eval(Noms_matrices(i,:))
> end
>
> I can get the data in all the files.
>
> My problem is that I can't add a column of data in all these files. When I 
> try to do eval(Noms_matrices(i,:)= something, I have the following error :
> ??? Unable to find subsindex function for class char
>
> Is there someone who could help me ?
> Thanks
> Rodrig´┐Żo 


0
3/23/2006 2:22:00 PM
Reply: