how to store heterogenous objects in matlab? -
how to store heterogenous objects in matlab? -
i need create image pyramid in matlab 1 of assignments. though there inbuilt methods individual images in pyramid, confused how store handles images. (i don't have much experience matlab)
arrays don't work, since images in pyramid of different size. looking list in .net, or arraylist in java. in http://stackoverflow.com/questions/1413860/matlab-linked-list, can utilize standard java classes, matlab hung when tried utilize java's arraylist. so, best way store collection of heterogeneous data(or handles?) in matlab?
edit1 : code not working:
im0 = imread('..\lenna-lg.jpg'); //im0 = 480*480*3 array im1 = impyramid(im0,'reduce'); //im1 = 240*240*3 array pyramid = [ im0, im1 ]; //error : error using ==> horzcat //cat arguments dimensions not consistent.
so farther searching, have found out called cell, seems heterogeneous array. (http://stackoverflow.com/questions/2662964/cell-and-array-in-matlab). next code working now
im0 = imread('..\lenna-lg.jpg'); //im0 = 480*480*3 array im1 = impyramid(im0,'reduce'); //im1 = 240*240*3 array cell = [ {im0}, {im1} ]; //cell = 1*2 cell ans = cell{1}; //ans = 480*480*3 array
this seems convenient way handle heterogeneous data. right way go this?
matlab
Comments
Post a Comment