From: us on
"Matteo " <matteo.niccoli(a)gmail.com> wrote in message <hsnoq1$da8$1(a)fred.mathworks.com>...
> I am trying to create a character array containing names for some filters using this code:
>
> for i=1:10
> names(i,:)=(['filter' char(num2str(i))])
> end
>
> I get the result below and also an error message. Can someone help me understand what is happening I do not see why the mismatch? Also, is there an easier way to create the character array as I want it? Thank you so much
> nms =
>
> filter1
> filter2
> filter3
> filter4
> filter5
> filter6
> filter7
> filter8
> filter9
>
> ??? Subscripted assignment dimension mismatch.

the reason for the error was already explained to you...

one of the solutions
- uses CELLs as containers...

ftmpl='filt%d';
fn=arrayfun(@(x) sprintf(ftmpl,x),1:3:12,'uni',false).'
%{
'filt1'
'filt4'
'filt7'
'filt10'
%}

us