Make your own free website on Tripod.com


Back


Virtual Instrument Array of ActiveX for MATLAB


I want to extend MATLAB's functions by VC for a long time. For no pressure, it is only a thought. These days, I wok with US students, most of them use MATLAB. I have no selection except to fit them. I try to use DLL and ActiveX to integrate VC to MATLAB. Both of them work, but ActiveX is more reasonable.
I design a ActiveX of Virtual Instrument Array to integrate my work into MATLAB. I work in VC, US students work in MATLAB, both of us are happy now.


Below is a list of Virtual Instrument Controls that I designed:
:
Press here to download VI array ActiveX with MATLAB Samples.(160KB)
.
Only four sentences are needed in MATLAB.
.
1. Insert VI Array ActiveX into MATLAB
VIHandle=actxcontrol('VIArrayMatlab.VIArrayMatlabCtrl.1', [x y w h], figureHandle);
2. Insert VI Control into MATLAB
 v = invoke (VIHandle, 'addIC2Container','ICName',ICID,'x,y,w,h','x,x,,...,x',x,x,....,x','','','','','');
 3. Set Value of VI Control
 invoke (VIHandle, 'setICValue',ICID,Line,Value);
 3. Set Value of VI Control
value = invoke (VIHandle, 'getICValue',ICID,Line);


This is a sample of MATLAB, which shows how to integrate VI Array of ActiveX into MATLAB:
Init Part
hl=actxcontrol('VIArrayMatlab.VIArrayMatlabCtrl.1', [0 0 550 160], fig);
v = invoke (hl, 'addIC2Container','RMeter',6000,'20,20,100,100','5,5,16777170,0,9,10','0,10,4,8,9,1,0','','','','','');
v = invoke (hl, 'addIC2Container','RMeter',6001,'160,20,100,100','5,5,15,0,9,10','0,100,4,8,9,1,1','','','','','');
v = invoke (hl, 'addIC2Container','DigitalMeter',6002,'300,40,160,60','10,10,10,25','7,15,4,0,10,1,1','0,100,0,1','','','','');
CallBack Part
v = invoke (hl, 'setICValue',6000,0,Amp);
v = invoke (hl, 'setICValue',6001,0,F);
v = invoke (hl, 'setICValue',6002,0,Pha);



Call Method of different VI Controls.


Label
Call:
addIC2GWVI("Font",ID,"x,y,w,h","s,c,e","Title"," type,bg, fg ,vc ","","","","");
Parameter:
"Font": VI name
ID: Resourcer ID
x,y,w,h: Position and size
s,c, e: s=font size, c=font position, e=font effect
Title: Text
Type,bg,fg,vc: Dispaly Type, Background Color, Text Color, Gradient
Example:
addIC2Container("Font",7000,"10,10,100,24","11,1,0","ABCDE","0,2,14,1","","","","");
addIC2Container("Font",7000,"10,10,24,100","11,1,0","ABCDE","1,2,14,1","","","","");
addIC2Container("Font",7000,"10,10,24,100","11,1,0","ABCDE","2,2,14,1","","","","");
[back]
.

Arrorw
Call:
addIC2GWVI("Arrow",ID,"x,y,w,h ","c,t1,t2,t","","","","","","");
Parameter:
"Arrow": VI name
ID: Resourcer ID
x,y,w,h: Position and size
c,t1,t2£ºArrow color, type of start point and end point
Example:
addIC2Container("Arrow",7000,"100,100,100,20","484286,1,1,0","","","","","","");
addIC2Container("Arrow",7000,"100,100,100,20","484286,1,1,1","","","","","","");
[back]
.

Border
Call:
addIC2GWVI("EdgeLine",ID,"x,y,w,h","type, width","","","","","",¡±¡±);
Parameter:
" EdgeLine": VI name
ID: Resourcer ID
x,y,w,h: Position and size
type, width: Border type, Width of border
Example:
addIC2Container("EdgeLine",7000,"10,10,200,120","0,3","","","","","","");
[back]
.

Line
Call:
addIC2Container("LineTracker",ID,"x1,y1,x2,y2,x3,y3,x4,y4","color","","","","","","");
Parameter:
" LineTracker ": VI name
ID: Resourcer ID
x1,y1,x2,y2,x3,y3,x4,y4: Position on nodes
color: Line color
Example:
addIC2Container("LineTracker",6000,"10,100,110,100,110,150,210,150","12","","","","","","");
[back]
.

Digital
Call:
addIC2GWVI("Digital",ID,"x,y,w,h","s,c,e","max,min,step,value","call","","","","");
Parameter:
"Digital": VI name
ID: Resourcer ID
x,y,w,h: Position and size
s,c, e: s=font size, c=font position, e=font effect
max,min,step,value: Maximum Value, Minimun Value, Step, Display Value
call: Callback function of  MATLAB (MATLAB only)
Example:
addIC2Container("Digital",7000,"200,100,100,22","11,1,0","10,0,0.1,5","","","","","");
[back]
.


EditBox
Call:
addIC2GWVI("EDIT",ID,"x,y,w,h"," s,c,e","value","type","call","","","");
Parameter:
"EDIT": VI name
ID: Resourcer ID
x,y,w,h: Position and size
s,c, e: s=font size, c=font position, e=font effect
value: Dispaly value
type: Data Type, 0=Data, 1=String
call: Callback function of  MATLAB (MATLAB only)
Example:
addIC2Container("EDIT",6000,"20,20,100,24","12,0,0","100","0","","","","");
[back]
.


 ChoiceBox
Call:
addIC2GWVI("Select",ID,"x,y,w,h","s,c,e","O1#O2#¡­.#","t,bg,fg,vc,n,v","call","","","");
Parameter:
"Select": VI name
ID: Resourcer ID
x,y,w,h: Position and size
s,c, e: s=font size, c=font position, e=font effect
O1#O2#O3#O4#¡­#: Items of selection, separated by "#"
t,bg,fg,vc,n,v: t=0Horiz/1Vert, Background Color, Text Color, Number of Boxs, Current selection
call: Callback function of  MATLAB (MATLAB only)
Example:
addIC2Container("Select",6000,"10,40,80,100","11,1,0","Option1#Option2#Option3#Option4#","3,7,0,4,0","","","","");  addIC2Container("Select",6000,"10,80,300,28","11,1,0","Option1#Option2#Option3#Option4#","2,7,0,4,0","","","","");
[back]
.


Droplist
Call:
addIC2GWVI("COMBOX",ID,"x,y,w,h","size,center,effect,st","item1,¡­,itemn ","","","","",¡±¡±);
Parameter:
"COMBOX": VI name
ID: Resourcer ID
x,y,w,h: Position and size
s,c, e, st: s=font size, c=font position, e=font effect, st=current item
item1,¡­,itemn: Data of items, separated by ","
Example:
addIC2Container("COMBOX",7000,"10,10,100,22","11,0,0,0","1,16,32,64","","","","","");
[back]
.


MultButton
Call:
addIC2GWVI("Xbutton",ID,"x,y,w,h","s,c,e","O1#O2#¡­.#","t,bg,fg,vc,n,v ","call","","","");
Parameter:
"Xbutton": VI name
ID: Resourcer ID
x,y,w,h: Position and size
s,c, e: s=font size, c=font position, e=font effect
O1#O2#O3#O4#¡­#: Items of selection, separated by "#"
t,bg,fg,vc,n,v: t=0Horiz/1Vert, Background Color, Text Color, Number of Boxs, Current selection
call: Callback function of  MATLAB (MATLAB only)
Example:
addIC2Container("XButton",6000,"10,40,280,28","11,1,0","Option1#Option2#Option3#Option4#","0,11,0,1,4,0","","","","");  addIC2Container("XButton",6000,"10,80,100,120","11,1,0","Option1#Option2#Option3#Option4#","1,10,0,1,4,0","","","","");
[back]
.


Button
Call:
addIC2GWVI("Button",ID,"x,y,w,h","s,c,e","Title"," t,bg, fg ,vc ","call","","","");
Parameter:
"Button": VI name
ID: Resourcer ID
x,y,w,h: Position and size
s,c, e: s=font size, c=font position, e=font effect
t,bg,fg,vc: Button type, Background Color, Text Color, Graident effect
call: Callback function of  MATLAB (MATLAB only)
Example:
addIC2Container("Button",7000,"10,30,100,30","11,1,0","On/Off","0,4,14,1","","","","");
addIC2Container("Button",7000,"10,70,100,30","11,1,0","Run","1,1,14,1","","","","");
addIC2Container("Button",7000,"10,120,40,80","11,1,0","Run","2,2,2,1","","","","");
addIC2Container("Button",7000,"100,120,80,40","11,1,0","Run","3,2,2,1","","","","");
addIC2Container("Button",7000,"200,70,40,80","11,1,0","Run","4,12632256,2,1","","","","");
addIC2Container("Button",7000,"200,70,40,80","11,1,0","Run","5,7,2,1","","","","");
addIC2Container("Button",7001,"200,170,80,40","11,1,0","Run","6,7,1,1","","","","");
[back]
.


GeoButton
Call:
addIC2GWVI("GeoButton",ID,"x,y,w,h","s,c,e","Title"," type,bg, fg ,vc ","call","","","");
Parameter:
"GeoButton": VI name
ID: Resourcer ID
x,y,w,h: Position and size
s,c, e: s=font size, c=font position, e=font effect
Title: Text
t,bg,fg,vc: Button type, Background Color, Text Color, Graident effect
call: Callback function of  MATLAB (MATLAB only)
Example:
addIC2Container("GeoButton",7000,"10,10,80,40","11,1,0","ABC","1,3,14,1","","","","");
[back]
.


ICONButton
Call:
addIC2GWVI("AppButton",ID,"x,y,w,h","pic", "type,bg,fg,vc ","i1,i2,i3,i4,¡­","call","",",¡±¡±);
Parameter:
"AppButton": VI name
ID: Resourcer ID
x,y,w,h: Position and size
pic: ICON ID
Type,bg,fg,vc: Button type,  Background Color, Text Color, Graident effect
i1,i2,i3,i4,i4,i5,i6,i7: ICON ID for RoundMultButton, or Char for MatrixButton
call: Callback function of  MATLAB (MATLAB only)
Example:
addIC2Container("AppButton",7000,"10,40,40,28","0","0,7,1","","","","","");
addIC2Container("AppButton",7000,"40,80,130,100","0","1,7,4,1","1,16,15,5,6,7,8","","","",""); addIC2Container("AppButton",7001,"100,100,120,120","0","2,13828006,9680639,1","3,4,1,2,3,4,5,6,7,8,9,*,0,#","","","","");
[back]
.


Knob
Call:
addIC2GWVI("Knob",ID,"x,y,w,h","r1,r2,bg,fg,cp,n","min,max,d,step,amp,t","call","","","","");
Parameter:
"Knob": VI name
ID: Resourcer ID
x,y,w,h: Position and size
r1,r2, bg,fg,cp,n: edge1 width,edge2 width, BackgroundColor, Foreground Color, Pin Color, Scale number
max,min,d,step,amp,t: Maximum Value, Minimun Value, Step, Display Value,Amplify Coef., Knob type
call: Callback function of  MATLAB (MATLAB only)
Example:
addIC2Container("Knob",7000,"100,100,100,100","5,5,3,0,4,10","0,10,4,0.1,1,0","","","","","");
addIC2Container("Knob",7000,"280,100,120,120","5,5,3,0,4,10","0,10,4,0.1,1,2","","","","","");
[back]
.


Knob Switch
Call:
addIC2GWVI("RSwitch ",ID,"x,y,w,h","r1,r2,bg,fg,cp,n","type,d","call","","","","");
Parameter:
" RSwitch ": VI name
ID: Resourcer ID
x,y,w,h: Position and size
r1,r2, bg,fg,cp,n: edge1 width,edge2 width, BackgroundColor, Foreground Color, Pin Color, Scale number
type,d: Switch type, Display Value,
call: Callback function of  MATLAB (MATLAB only)
Example:
addIC2Container("RSwitch",7000,"200,100,100,100","5,5,3,0,4,10","1,1","","","","","");
addIC2Container("RSwitch",7000,"200,100,100,100","5,5,3,0,4,10","3,1","","","","","");
[back]
.


Scroll
Call:
addIC2GWVI("ScrollBar",ID,"x,y,w,h","st,c0,c1,c2,c3,cbg,num,type","min,max,v1,v2,dt,amp","call","","","","");
Parameter:
"ScrollBar": VI name
ID: Resourcer ID
x,y,w,h: Position and size
st,c0,c1,c2,c3,cbg,num,type: st=0Border/1NoBorder,"c0,c1,c2,c3,cbg"=color, num=scale, type=scroll type
min,max,v1,v2,dt,amp: Maximum Value, Minimun Value, Display Value1, Display Value2,Step, Amplify Coef., Knob type
call: Callback function of  MATLAB (MATLAB only)
Example:
addIC2Container("ScrollBar",7000,"20,80,180,60","0,2,4,0,12,14864291,10,1","0,10,4,6,0.1,2","","","","","");
addIC2Container("ScrollBar",7000,"20,20,60,160","0,2,4,0,12,14864291,10,0","0,10,4,6,0.1,1","","","","","");
addIC2Container("ScrollBar",7000,"20,80,180,60","0,2,4,0,12,14864291,10,2","0,10,4,6,0.1,1","","","","","");
addIC2Container("ScrollBar",7000,"20,80,180,60","0,2,4,0,12,14864291,10,3","0,10,4,6,0.1,1","","","","","");
addIC2Container("ScrollBar",7000,"20,20,60,160","0,2,4,0,12,14864291,10,4","0,10,4,6,0.1,1","","","","","");
addIC2Container("ScrollBar",7000,"20,80,180,20","0,7,4,0,12,14864291,10,5","0,10,4,6,0.1,2","","","","","");
addIC2Container("ScrollBar",7000,"20,40,20,160","0,7,4,0,12,14864291,10,6","0,10,4,6,0.1,1","","","","","");
[back]
.


Tempature
Call:
addIC2GWVI("Tempature",ID,"x,y,w,h","left,right,top,bottom","bg,bg1,rectg,cline,n,border,t","min,max,value,amp","","","","");
Parameter:
" Tempature": VI name
ID: Resourcer ID
x,y,w,h: Position and size
left,right,,top,bottom: Distance to the border
bg,bg1,rectg,cline,n,border,t: "bg,bg1,rectg,cline"=Color, n=scale, border=0show/1hide, t=Control type
min,max,value,amp: Maximum Value, Minimun Value, Display Value, Amplify Coef.
Example:
 addIC2Container("Tempature",7000,"40,40,60,120","30,10,10,10","7,1,4,0,10,1,1","0,10,4,2","","","","");
 addIC2Container("Tempature",7000,"140,40,60,120","30,10,10,10","14864291,1,4,0,10,1,2","0,10,4,1","","","","");
 addIC2Container("Tempature",7000,"200,100,120,60","10,10,10,30","14864291,1,4,0,10,1,3","0,10,4,1","","","","");
[back]
.


Digital Meter
Call:
addIC2GWVI("DigitalMeter",ID,"x,y,w,h","left,right,top,bottom","bg,bg1,rectg,cline,n,border,t","min,max,value,amp","","","","");
Parameter:
"DigitalMeter": VI name
ID: Resourcer ID
x,y,w,h: Position and size
left,right,,top,bottom: Distance to the border
bg,bg1,rectg,cline,n,border,t: "bg,bg1,rectg,cline"=Color, n=scale, border=0show/1hide, t=Control type
min,max,value,amp: Maximum Value, Minimun Value, Display Value, Amplify Coef.
Example:
 addIC2Container("DigitalMeter",7000,"100,100,60,140","30,10,10,10","7,15,4,0,10,1,0","0,10,4,1","","","","");
 addIC2Container("DigitalMeter",7000,"200,100,160,60","10,10,10,25","7,15,4,0,10,1,1","0,10,4,1","","","","");
[back]
.


RoundMeter
Call:
addIC2GWVI("RMeter",ID,"x,y,w,h","r1,r2,bg,fg,cp,dr","min,max,d,v1,v2,amp,type","","","","","");
Parameter:
"RMeter": VI name
ID: Resourcer ID
x,y,w,h: Position and size
r1,r2, bg,fg,cp,dr edge1 width,edge2 width, BackgroundColor, Foreground Color, Pin Color, Meter width
max,min,d,v1,v2,amp,type: Maximum Value, Minimun Value, Display Value,Warnning value1,Warnning Value2,Amplify Coef., Control type
Example:
addIC2Container("RMeter",7000,"20,80,100,100","5,5,16777170,0,9,10","0,10,4,8,9,1,0","","","","",""); addIC2Container("RMeter",7000,"180,80,100,100","5,5,15,0,9,10","0,10,4,8,9,1,1","","","","","");
[back]
.


Rectangle Meter
Call:
addIC2GWVI("Meter",ID,"x,y,w,h","dx,dh,dr,bg,fg,cp,cm,t","min,max,d,ct1,ct2,tw,border,amp","","","","","");
Parameter:
"Meter": VI name
ID: Resourcer ID
x,y,w,h: Position and size
dx,dh,dr,bg,fg,cp,cm,t: "dx,dh,dr"=edge, "bg,fg,cp,cm"=color, t=Control type
max,min,d: Maximum Value, Minimun Value, Display Value
ct1,ct2,tw,border,amp: "ct1,ct2"=Gradient color, tw=Meter width, Border=0show/1hide, amp=Amplify Coef
Example:
addIC2Container("Meter",7000,"20,40,140,80","6,6,7,0,12,12,16757864","0,10,4,10,12,15,1,0","","","","",""); addIC2Container("Meter",7000,"220,40,80,140","10,10,7,0,12,12,16757864","0,10,4,10,12,15,1,1","","","","",""); addIC2Container("Meter",7000,"360,40,80,140","10,10,7,0,12,12,16757864","0,10,4,10,12,15,1,2","","","","",""); addIC2Container("Meter",7000,"20,240,140,80","10,10,14080689,0,12,12,16757864","0,10,4,10,12,15,1,3","","","","",""); addIC2Container("Meter",7000,"20,240,140,80","24,24,14080689,0,12,12,16757864","0,10,4,10,12,15,3,4","","","","","");
addIC2Container("Meter",7000,"220,40,80,160","24,24,14080689,0,12,12,16757864","0,10,4,10,12,15,3,5","","","","","");
addIC2Container("Meter",7000,"360,40,80,160","24,24,7,0,12,12,16757864","0,10,4,10,12,15,3,6","","","","","");
[back]
.


Progress
Call:
addIC2GWVI("Progress",ID,"x,y,w,h"," type,bg,fg,tg","v","","","","","");
Parameter:
" Progress": VI name
ID: Resourcer ID
x,y,w,h: Position and size
type,bg,fg,tg: type=Control type, "bg,fg,tg"=color
v: Dispaly value
Example:
addIC2Container("Progress",7000,"200,100,120,50","1,1,14,5","50","","","","","");
addIC2Container("Progress",7000,"200,100,120,50","2,7,2,15593935","50","","","","","");
addIC2Container("Progress",7000,"200,100,54,120","3,7,2,15593935","50","","","","","");
[back]
.


LED
Call:
addIC2GWVI("LED",ID,"x,y,w,h"," bg,fg,n,t","v","","","","","");
Parameter:
"LED": VI name
ID: Resourcer ID
x,y,w,h: Position and size
bg,fg,n,t: background color, digital color, number, alignment
v: Dispaly value
Example:
addIC2Container("LED",7000,"200,100,120,50","1,14,5,1","20","","","","","");
[back]
.


Lamp
Call:
addIC2GWVI("LAMP",ID,"x,y,w,h"," c1,c2,c3,c4,st,t","","","","","","");
Parameter:
"LAMP": VI name
ID: Resourcer ID
x,y,w,h: Position and size
c1,c2,c3,c4,st,t: "c1,c2,c3,c4"=color, st=current statu, t=contol type
Example:
addIC2Container("LAMP",7000,"100,100,140,30","10,14,12,8,0,2","","","","","","");
addIC2Container("LAMP",7010,"100,200,60,60","10,14,12,3,0,0","","","","","","");
[back]
.


Gird
Call:
addIC2GWVI("Gird",ID,"x,y,w,h","scroll,row,wfirst,,cfirst,chigh,col,size","CTitle","RTitle","w1,w2,¡­wn","","","");
Parameter:
"Gird": VI name
ID: Resourcer ID
x,y,w,h: Position and size
scroll,row,wfirst,cfirst,chigh,col,size:scroll=0hide/1show, row, first row width, first col hight, other col hight, col,font size
Ctitle: Items of col
Rtitle: Items of row
w1,w2,¡­wn: width of row
Example:
addIC2Container("Gird",7000,"10,10,300,100","1,5,40,22,18,10,10","A,B,C,D,E","1,2,3,4","80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80","","","");
SET and GET command can be use to read or write a cell value. Such as:
setICString(6000,0,"2,1,SET,Hi");
char *s=getICString(6000,2*1000+1); //Gird
[back]
.


.
.
.
.
.
.
.
.
.
.