Setting graph figure size

The properties that can be set for a figure is referenced here. You could then use: figure_number = 1; x = 0; % Screen position y = 0; % Screen position width = 600; % Width of figure height = 400; % Height of figure (by default in pixels) figure(figure_number, ‘Position’, [x y width height]);

The meaning of colon operator in MATLAB

Actually a:b generates a vector. You could use it as index only because the (…) accepts a list also, e.g. octave-3.0.3:10> a = [1,4,7] a = 1 4 7 octave-3.0.3:11> b = [1,4,9,16,25,36,49] b = 1 4 9 16 25 36 49 octave-3.0.3:12> b(a) # gets [b(1), b(4), b(7)] ans = 1 16 49 Now, … Read more

What are some efficient ways to combine two structures in MATLAB?

Without collisions, you can do M = [fieldnames(A)’ fieldnames(B)’; struct2cell(A)’ struct2cell(B)’]; C=struct(M{:}); And this is reasonably efficient. However, struct errors on duplicate fieldnames, and pre-checking for them using unique kills performance to the point that a loop is better. But here’s what it would look like: M = [fieldnames(A)’ fieldnames(B)’; struct2cell(A)’ struct2cell(B)’]; [tmp, rows] = … Read more