From: Andy on
> It is not a function,it is obvious us...i had a msprint here, but please can you answer my question?...I think it is simple for you.
> Thanks.

I think he answered your question. Rather than naming your variables proc1m, proc2m, etc., you should instead have a vector called proc (or procm, or whatever you want to call it) and think of the index as the name. So instead of proc1m, you would have procm(1). Instead of proc2m, you should have procm(2), and so on.

Have you tried the code us gave you?
From: Jose on
"Andy " <theorigamist(a)gmail.com> wrote in message <i0aqk2$7cb$1(a)fred.mathworks.com>...
> > It is not a function,it is obvious us...i had a msprint here, but please can you answer my question?...I think it is simple for you.
> > Thanks.
>
> I think he answered your question. Rather than naming your variables proc1m, proc2m, etc., you should instead have a vector called proc (or procm, or whatever you want to call it) and think of the index as the name. So instead of proc1m, you would have procm(1). Instead of proc2m, you should have procm(2), and so on.
>
> Have you tried the code us gave you?

Yes...Andy and Us...this is my code:



Main program

sendvar2m=1

if sendvar2m~=0
s=receivestructure(sock)
panel=find(s.elused~=0);
else
suc=1;
end

if ishandle(Figure)
return;
end

Figure=figure(100);

k=length(panel)

i=0;
if k==1

i=i+1;

hfigure{panel(i)}=figure(panel(i));
set(figure(panel(i)),'Name',['channel ' num2str(panel(i))],'Numbertitle','off','Position',[0 378 560 420])
proc1m=uicontrol('parent',hfigure{3},'String', num2str(panel(i)),...
'Position', [240,400,60,20]);
set(proc1m,'Callback',@(src,event)proc1(src,event));
end

Proc1m and the function proc1.....I would like to change it for procnum2str(panel(i))m or the function proc1num2str(panel(i))..or something like that...because the procXm, and the function procX...where X is an element of the
vector panel.

Maybe now it is more clear, or maybe i can confuse you more.

Please, try to answer my question...I think it is not complicate...I am agree with you andy and us that I can use procm(1)...but my question is...is possible to write down
something like procnum2str(panel(i))m?
From: Andy on
Have you tried concatenating with brackets? I.e.

['proc' num2str(i)]
From: us on
"Jose "
> Proc1m and the function proc1.....I would like to change it for procnum2str(panel(i))m or the function proc1num2str(panel(i))..or something like that...because the procXm, and the function procX...where X is an element of the
> vector panel.
>
> Maybe now it is more clear, or maybe i can confuse you more.
>
> Please, try to answer my question...I think it is not complicate...I am agree with you andy and us that I can use procm(1)...but my question is...is possible to write down
> something like procnum2str(panel(i))m?

BUT WHY WOULD YOU WANT TO DO THIS(??!!)...

US
caps-lock off...
From: Steven Lord on

"Jose " <jose.l.vega(a)gmail.com> wrote in message
news:i0arn4$j9e$1(a)fred.mathworks.com...
> "Andy " <theorigamist(a)gmail.com> wrote in message
> <i0aqk2$7cb$1(a)fred.mathworks.com>...

*snip*

> hfigure{panel(i)}=figure(panel(i));
> set(figure(panel(i)),'Name',['channel '
> num2str(panel(i))],'Numbertitle','off','Position',[0 378 560 420])
> proc1m=uicontrol('parent',hfigure{3},'String', num2str(panel(i)),...
> 'Position', [240,400,60,20]);
> set(proc1m,'Callback',@(src,event)proc1(src,event));
> end
>
> Proc1m and the function proc1.....I would like to change it for
> procnum2str(panel(i))m or the function proc1num2str(panel(i))..or
> something like that...because the procXm, and the function procX...where X
> is an element of the
> vector panel.

Yes, and us said DON'T DO THAT. [I agree with him.] Instead:

procm(1) = uicontrol(...)
set(procm(1), 'Callback', ...

If you must refer to functions named proc1, proc2, etc. then use STR2FUNC to
create function handles to those functions. If not (for example, proc1 is
very similar to proc2 except it uses a 1 in one place instead of a 2) then
do something like:

set(procm(z), 'Callback', @(src, event) proc(src, event, z))

and have proc use the third input in the place where it would have used the
number associated with each function.

> Maybe now it is more clear, or maybe i can confuse you more.
>
> Please, try to answer my question...I think it is not complicate...I am
> agree with you andy and us that I can use procm(1)...but my question
> is...is possible to write down
> something like procnum2str(panel(i))m?

Technically yes, but it's very strongly discouraged. See Q4.6 in the
newsgroup FAQ for an explanation.

--
Steve Lord
slord(a)mathworks.com
comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ
To contact Technical Support use the Contact Us link on
http://www.mathworks.com