Jump to content


Popular Content

Showing content with the highest reputation on 09/25/14 in all areas

  1. 1 point
    The 'expression' property of fvg objects has a few more advanced options for truly customized output. One of these is the ability to bring in a workspace variable as part of your expression. Just put a dollar sign ($) in front of the variable that you wish to include from your workspace, ie. if you have a variable a=2; and you want to offset your water levels by this then '$a+H' would be your expression string. For single scalars though it is probably better to specify it directly, ie. if you want to offset all the water levels by 2m then 'H+2' is easier than storing the 2m in a variable beforehand. The real strength of this is for vectors, keep in mind that as usual, these vector and matrix operations will have specific limitations on size, and there are no extra checks in place to account for this. A useful example of using this is to plot the difference in a variable since a particular timestep, for example the start. A quick example is plotting the total change in bed level since the beginning of the model run, it will require extracting a variable seperately first. tmp = netcdf_get_var(modfil,'names','ZB','timestep',1); %BMTWBM function that will extract ZB at the first timestep firstbedlevel = tmp.ZB; %get it out of a structure and save it to a useful variable fobj = fvgraphics; %usual, gca customsheet = fvg_sheet(fobj, modfil, 'expression', 'ZB - $firstbedlevel') There are a lot of possibilities with this, the only downside being that it does require a bit of setting up first to get the variable that you want. Keep in mind that this variable will be 'saved' into the function persistantly, so even if you clear the original 'firstbedlevel' from your workspace, or change it, only the original one will be used in the calculations. If you wish to update the variable, then you must call the 'set' method on the expression again. ie. firstbedlevel = firstbedlevel+1; %changed the variable set(customsheet,'expression','ZB - $firstbedlevel'); %now it will bring in the new version of 'firstbedlevel';
  • Create New...