function  writedevices(devdescr, prefix, values)

n = length(devdescr);
nv = length(values);

if (nv < n) 
  fprintf(1,'Array with values to be set is shorter then array of devices\n');
  return;
end

debug = 1;
if (debug) fprintf(1,'There is %d devices\n',n); end;


for i=1:n
  devicename = [prefix devdescr(i).name];
  if(debug) fprintf(1,'Writing %s',devicename); end;

  if (devdescr(i).isfesa)
    if(debug) fprintf(1,' of FESA type\n'); end;
    Jsetcontrolvalfesa(devicename,'Setting',values(i)); 
  else  
    if(debug) fprintf(1,' of GM type\n');end;
    Jsetcontrolval(devicename,'CCV',values(i));
  end
    
end

