
Reference to a cleared variable
Posted:
Feb 25, 2014 10:06 PM


"Yair Altman" wrote in message <lef1j2$kjj$1@newscl01ah.mathworks.com>... > "SAMEER ahamed" <sameersoft6@gmail.com> wrote in message <leece7$4h2$1@newscl01ah.mathworks.com>... > > Hi, > > > > I am newbie for Matlab , now i want to from matlab pass values to java method . > > Below My Java Code : > > public static void sampleTest(int width ,int height ,List<Integer> points){ > > Sample recordedSample = new Sample (); > > recordedSample.setHeight(height); > > recordedSample.setWidth(width); > > recordedSample.getMatrix().add(points); > > } > > Below My Matlab Code : > > %From My 10 frames Video file read > > width =vidobj.width; > > height =vidobj.height; > > for int i=1:10 > > matrix{1,i}=[3,2,,4,2,4,3,2,4];%Dynamic values 1by8 matrix > > end > > clear java; > > import edu.lipreading.*; > > training = TrainingPanel; > > javaMethod('recordSample',training,int32(width),int32(height),matrix{1,i}); > > > > Result :When I have run my Matlab code i got Error like : > > Reference to a cleared variable width. > > > > Error in imqacdemo03>pb_liveread_Callback (line 445) > > javaMethod('recordSample',training,int32(width),int32(height),matrix{1,i}); > > > Unfortunately, the "clear java" command has the effect of clearing the workspace, including the width and height vars. Simply delete this command, you don't need it. > > Yair Altman > http://UndocumentedMatlab.com > Read my MatlabJava programming book Thank's for reply me ..It's work for me .thank you so much..now i have another problem from above matrix{1,i} variable . when i have run command matlab ,i got values like from matrix{1,i} cell array 2 2 2 2 1 1 2 3 4 2 1 2 2 33 3 4 %1by8 matrix each frame values ,now i want to form below like matrix=[[2,2,2,2,1,1,2,3],[4,2,1,2,2,33,3,4]];etc. Note : For understanding reference please look at http://www.mathworks.in/matlabcentral/answers/118712howtoexportxmlfile

