function MGA = mgaget(shot,raw)
% function MGA = mgaget(shot,raw)
% get all MGA nodes into a structure

if nargin<2, raw=true; end

if raw, mdsread = @mdsvalueraw;
else,   mdsread = @mdsvalue;
end

mdsopen('pcs',shot)
for node = deblank(mdsdata('GETNCI("\\PCS::MGAMS.MGA:*","NODE_NAME")'))'
 [MGA.(node{1}),status] = mdsread(['\MGA:' node{1}]);
 assert(logical(rem(status,2)),'Cannot read MGA node %s: %s',node{1},mdsdata('GETMSG($1)',status));
end

end
