@@ -176,7 +176,7 @@ function qp_updatefieldprop(UD)
176176 set(MW .TZtxt ,' visible' ,' off' )
177177else
178178 if sz(T_ )>0
179- [Chk ,TZshift ,TZstr ]=qp_getdata(Info ,DomainNr ,Props(fld ),' timezone' );
179+ [~ ,TZshift ,TZstr ]=qp_getdata(Info ,DomainNr ,Props(fld ),' timezone' );
180180 if isnan(TZshift )
181181 TZstr = ' unknown' ;
182182 elseif ~strcmpi(TZhandling ,' as in dataset' )
@@ -269,7 +269,7 @@ function qp_updatefieldprop(UD)
269269%
270270% Show station selection or MNK/XYZ selection controls
271271%
272- stlist = 1 ;
272+ showStationNames = false ;
273273if DimFlag(ST_ )
274274 %
275275 % Stations, so show station selection controls and hide MNK/XYZ
@@ -282,10 +282,10 @@ function qp_updatefieldprop(UD)
282282 if sz(ST_ )>30000 || ~ismember(DimFlag(ST_ ),[0 3 5 13 15 ])
283283 set(MW .Stat ,' visible' ,' on' )
284284 set(MW .StList ,' visible' ,' off' )
285- stlist= 0 ;
286285 else
287286 set(MW .Stat ,' visible' ,' off' )
288287 set([MW .S MW .AllS MW .StList ],' visible' ,' on' )
288+ showStationNames = true ;
289289 end
290290else
291291 %
@@ -485,7 +485,7 @@ function qp_updatefieldprop(UD)
485485 set(UDM ,' string' ,mstr ,' enable' ,' on' ,vis{: })
486486 set(UDAllM ,' enable' ,allmon ,' value' ,allm ,' userdata' ,{allm selm sz(m_ )},vis{: })
487487 set(UDEditM ,' string' ,vec2str(selm ,' nobrackets' ,' noones' ),' userdata' ,selm ,vis{: })
488- if allm ,
488+ if allm
489489 set(UDEditM ,' enable' ,' off' ,' backgroundcolor' ,Inactive );
490490 else
491491 set(UDEditM ,' enable' ,' on' ,' backgroundcolor' ,Active );
@@ -517,29 +517,28 @@ function qp_updatefieldprop(UD)
517517 % been disabled.
518518 %
519519 if m_ ==ST_
520- [Chk ,Stats ]=qp_getdata(Info ,DomainNr ,Props(fld ),' stations' );
521- if stlist
522- if isempty(Stats ) && sz(ST_ )==0
523- set(MW .S ,' enable' ,' off' )
524- set(MW .StList ,' visible' ,' on' ,' enable' ,' off' ,' value' ,1 ,' string' ,' ' ,' backgroundcolor' ,Inactive )
525- else
526- if isempty(Stats )
527- x= sz(ST_ );
528- Statw= ceil(log10(x + 1 ));
529- Stats= sprintf(strcat(' %-' ,num2str(Statw ),' i' ),1 : x );
530- Stats= cat(2 ,repmat(' station ' ,x ,1 ),reshape(Stats ,[Statw ,x ])' );
531- % for j=sz(ST_):-1:1, Stats{j}=sprintf('station %i',j); end
532- elseif iscellstr(Stats )
533- Stats= char(Stats ); % use char instead of strvcat to keep empty names
534- end
520+ nStations = sz(ST_ );
521+ if sz(ST_ ) == 0
522+ set(MW .S ,' enable' ,' off' )
523+ set(MW .StList ,' visible' ,' on' ,' enable' ,' off' ,' value' ,1 ,' string' ,' ' ,' backgroundcolor' ,Inactive )
524+ else
525+ [~ ,stationNames ]=qp_getdata(Info ,DomainNr ,Props(fld ),' stations' );
526+ if length(stationNames ) ~= nStations
527+ numberLength = ceil(log10(nStations + 1 ));
528+ numberFormat = strcat(' %-' ,num2str(numberLength ),' i' );
529+ stationNumbers = sprintf(numberFormat , 1 : nStations );
530+ stationNames = cat(2 ,repmat(' station ' ,nStations ,1 ),reshape(stationNumbers ,[Statw ,nStations ])' );
531+ stationNames = cellstr(stationNames );
532+ end
533+ if showStationNames
535534 if allm
536- set(MW .StList ,' visible' ,' on' ,' enable' ,' off' ,' value' ,1 ,' string' ,Stats ,' backgroundcolor' ,Inactive ,' userdata' ,Stats )
535+ set(MW .StList ,' visible' ,' on' ,' enable' ,' off' ,' value' ,1 ,' string' ,stationNames ,' backgroundcolor' ,Inactive ,' userdata' ,stationNames )
537536 else
538- set(MW .StList ,' visible' ,' on' ,' enable' ,' on' ,' value' ,selm ,' string' ,Stats ,' backgroundcolor' ,Active ,' userdata' ,Stats )
537+ set(MW .StList ,' visible' ,' on' ,' enable' ,' on' ,' value' ,selm ,' string' ,stationNames ,' backgroundcolor' ,Active ,' userdata' ,stationNames )
539538 end
539+ else
540+ set(MW .StList ,' visible' ,' off' ,' enable' ,' off' ,' userdata' ,stationNames )
540541 end
541- else
542- set(MW .StList ,' visible' ,' off' ,' enable' ,' off' ,' userdata' ,Stats )
543542 end
544543 end
545544 else
@@ -582,7 +581,7 @@ function qp_updatefieldprop(UD)
582581
583582 if DimFlag(M_ ) && DimFlag(N_ )
584583 % structured 2D domain
585- [mnexp ,mn1 ]=piecewise(mn ,sz([M_ N_ ]));
584+ [~ ,mn1 ]=piecewise(mn ,sz([M_ N_ ]));
586585 else
587586 % unstructured domain
588587 mmax = get(MW .MaxM ,' userdata' );
@@ -607,7 +606,7 @@ function qp_updatefieldprop(UD)
607606 mnstr(end - 1 : end )=[];
608607 else
609608 mnstr= ' ' ;
610- mnl = [];
609+ mn1 = [];
611610 end
612611 set(MW .EditMN ,' string' ,mnstr ,' userdata' ,mn1 )
613612 end
0 commit comments