WICHTIG: Der Betrieb von goMatlab.de wird privat finanziert fortgesetzt. - Mehr Infos...

Mein MATLAB Forum - goMatlab.de

Mein MATLAB Forum

 
Gast > Registrieren       Autologin?   

Partner:




Forum
      Option
[Erweitert]
  • Diese Seite per Mail weiterempfehlen
     


Gehe zu:  
Neues Thema eröffnen Neue Antwort erstellen

Tiefstellung von Zeichen in StaticText Feldern

 

Robert
Forum-Fortgeschrittener

Forum-Fortgeschrittener


Beiträge: 60
Anmeldedatum: 14.11.08
Wohnort: Istanbul
Version: 2010b
     Beitrag Verfasst am: 05.12.2008, 12:44     Titel: Tiefstellung von Zeichen in StaticText Feldern
  Antworten mit Zitat      
Hallo Leute,

hab mich gerade in der Matlab Hilfe schlau gemacht, was die Tiefstellung ("subscript") angeht. Da sind auch hübsche Beispiele drin, aber alle bezogen auf "text". Geht das mit dem Latex Interpreter nicht auch irgendwie mit Static Text Feldern?
Oder hat jemand einen anderen Lösungsansatz für Hoch-/Tiefstellung in Statictext Feldern?

Grüße
Robert
Private Nachricht senden Benutzer-Profile anzeigen


Gast

Gast


Beiträge: ---
Anmeldedatum: ---
Wohnort: ---
Version: ---
     Beitrag Verfasst am: 05.12.2008, 12:48     Titel:
  Antworten mit Zitat      
Das könnte hiermit klappen: http://www.mathworks.com/matlabcentral/fileexchange/10743
 
Robert
Themenstarter

Forum-Fortgeschrittener

Forum-Fortgeschrittener


Beiträge: 60
Anmeldedatum: 14.11.08
Wohnort: Istanbul
Version: 2010b
     Beitrag Verfasst am: 05.12.2008, 14:57     Titel:
  Antworten mit Zitat      
Ok, hab das mal runtergeladen und damit rumgespielt. Mir ist jetzt aber noch nicht ganz klar, ob ich alle Textfelder als "uibutton" mit ('Style','Text') erstellen muss, oder ob ich die function uibutton mit meinen vorhanden Textfeldern benutzen kann. Dann stellt sich nämlich das Problem, dass ich den GUIDE zum erstellen der grafischen Oberfläche benutze. Das kann ich ja dann mit diesen "uibottons" vergessen. Richtig?!

Hier mal der Code der m-File von Mathworks:
Code:

function [hout,ax_out] = uibutton(varargin)
%uibutton: Create pushbutton with more flexible labeling than uicontrol.
% Usage:
%   uibutton accepts all the same arguments as uicontrol except for the
%   following property changes:
%
%     Property      Values
%     -----------   ------------------------------------------------------
%     Style         'pushbutton', 'togglebutton' or 'text', default =
%                   'pushbutton'.
%     String        Same as for text() including cell array of strings and
%                   TeX or LaTeX interpretation.
%     Interpreter   'tex', 'latex' or 'none', default = default for text()
%
% Syntax:
%   handle = uibutton('PropertyName',PropertyValue,...)
%   handle = uibutton(parent,'PropertyName',PropertyValue,...)
%   [text_obj,axes_handle] = uibutton('Style','text',...
%       'PropertyName',PropertyValue,...)
%
% uibutton creates a temporary axes and text object containing the text to
% be displayed, captures the axes as an image, deletes the axes and then
% displays the image on the uicontrol.  The handle to the uicontrol is
% returned.  If you pass in a handle to an existing uicontol as the first
% argument then uibutton will use that uicontrol and not create a new one.
%
% If the Style is set to 'text' then the axes object is not deleted and the
% text object handle is returned (as well as the handle to the axes in a
% second output argument).
%
% See also UICONTROL.

% Version: 1.6, 20 April 2006
% Author:  Douglas M. Schwarz
% Email:   dmschwarz=ieee*org, dmschwarz=urgrad*rochester*edu
% Real_email = regexprep(Email,{'=','*'},{'@','.'})


% Detect if first argument is a uicontrol handle.
keep_handle = false;
if nargin > 0
   h = varargin{1};
   if isscalar(h) && ishandle(h) && strcmp(get(h,'Type'),'uicontrol')
      keep_handle = true;
      varargin(1) = [];
   end
end

% Parse arguments looking for 'Interpreter' property.  If found, note its
% value and then remove it from where it was found.
interp_value = get(0,'DefaultTextInterpreter');
arg = 1;
remove = [];
while arg <= length(varargin)
   v = varargin{arg};
   if isstruct(v)
      fn = fieldnames(v);
      for i = 1:length(fn)
         if strncmpi(fn{i},'interpreter',length(fn{i}))
            interp_value = v.(fn{i});
            v = rmfield(v,fn{i});
         end
      end
      varargin{arg} = v;
      arg = arg + 1;
   elseif ischar(v)
      if strncmpi(v,'interpreter',length(v))
         interp_value = varargin{arg+1};
         remove = [remove,arg,arg+1];
      end
      arg = arg + 2;
   elseif arg == 1 && isscalar(v) && ishandle(v) && ...
         any(strcmp(get(h,'Type'),{'figure','uipanel'}))
      arg = arg + 1;
   else
      error('Invalid property or uicontrol parent.')
   end
end
varargin(remove) = [];

% Create uicontrol, get its properties then hide it.
if keep_handle
   set(h,varargin{:})
else
   h = uicontrol(varargin{:});
end
s = get(h);
if ~any(strcmp(s.Style,{'pushbutton','togglebutton','text'}))
   delete(h)
   error('''Style'' must be pushbutton, togglebutton or text.')
end
set(h,'Visible','off')

% Create axes.
parent = get(h,'Parent');
ax = axes('Parent',parent,...
   'Units',s.Units,...
   'Position',s.Position,...
   'XTick',[],'YTick',[],...
   'XColor',s.BackgroundColor,...
   'YColor',s.BackgroundColor,...
   'Box','on',...
   'Color',s.BackgroundColor);
% Adjust size of axes for best appearance.
set(ax,'Units','pixels')
pos = round(get(ax,'Position'));
if strcmp(s.Style,'text')
   set(ax,'Position',pos + [0 1 -1 -1])
else
   set(ax,'Position',pos + [4 4 -8 -8])
end
switch s.HorizontalAlignment
   case 'left'
      x = 0.0;
   case 'center'
      x = 0.5;
   case 'right'
      x = 1;
end
% Create text object.
text_obj = text('Parent',ax,...
   'Position',[x,0.5],...
   'String',s.String,...
   'Interpreter',interp_value,...
   'HorizontalAlignment',s.HorizontalAlignment,...
   'VerticalAlignment','middle',...
   'FontName',s.FontName,...
   'FontSize',s.FontSize,...
   'FontAngle',s.FontAngle,...
   'FontWeight',s.FontWeight,...
   'Color',s.ForegroundColor);

% If we are creating something that looks like a text uicontrol then we're
% all done and we return the text object and axes handles rather than a
% uicontrol handle.
if strcmp(s.Style,'text')
   delete(h)
   if nargout
      hout = text_obj;
      ax_out = ax;
   end
   return
end

% Capture image of axes and then delete the axes.
frame = getframe(ax);
delete(ax)

% Build RGB image, set background pixels to NaN and put it in 'CData' for
% the uicontrol.
if isempty(frame.colormap)
   rgb = frame.cdata;
else
   rgb = reshape(frame.colormap(frame.cdata,:),[pos([4,3]),3]);
end
size_rgb = size(rgb);
rgb = double(rgb)/255;
back = repmat(permute(s.BackgroundColor,[1 3 2]),size_rgb(1:2));
isback = all(rgb == back,3);
rgb(repmat(isback,[1 1 3])) = NaN;
set(h,'CData',rgb,'String','','Visible',s.Visible)

% Assign output argument if necessary.
if nargout
   hout = h;
end

 
Private Nachricht senden Benutzer-Profile anzeigen
 
Robert
Themenstarter

Forum-Fortgeschrittener

Forum-Fortgeschrittener


Beiträge: 60
Anmeldedatum: 14.11.08
Wohnort: Istanbul
Version: 2010b
     Beitrag Verfasst am: 19.12.2008, 14:03     Titel: Problem mit uibutton.m
  Antworten mit Zitat      
Hallo Leute,

ich will nochmal das Hoch-/Tiefstellen Thema aufgreifen.
Mit diesem uibutton funktioniert das ganz gut, jedoch habe ich ein Problem mit der Eigenschaft "Position". Die spuckt mir Matlab bei Eingabe von get(text1,'Position') als 3 Spaltenvektor aus [0.5 0.5 0]. Komisch, oder?
Wenn ich set(text1,'Position',[10 10 10 10]) eintippe meckert er nicht... Versteh das nicht ganz...
Bei der Eigenschaft "Extent" kommt ein 4-Spaltenvektor zurück, so wie es sein sollte.

Hat jemand Erfahrung mit diesem uibutton? Bin um jeden Tip dankbar!

Grüße
Robert
Private Nachricht senden Benutzer-Profile anzeigen
 
Neues Thema eröffnen Neue Antwort erstellen



Einstellungen und Berechtigungen
Beiträge der letzten Zeit anzeigen:

Du kannst Beiträge in dieses Forum schreiben.
Du kannst auf Beiträge in diesem Forum antworten.
Du kannst deine Beiträge in diesem Forum nicht bearbeiten.
Du kannst deine Beiträge in diesem Forum nicht löschen.
Du kannst an Umfragen in diesem Forum nicht mitmachen.
Du kannst Dateien in diesem Forum posten
Du kannst Dateien in diesem Forum herunterladen
.





 Impressum  | Nutzungsbedingungen  | Datenschutz | FAQ | goMatlab RSS Button RSS

Hosted by:


Copyright © 2007 - 2024 goMatlab.de | Dies ist keine offizielle Website der Firma The Mathworks

MATLAB, Simulink, Stateflow, Handle Graphics, Real-Time Workshop, SimBiology, SimHydraulics, SimEvents, and xPC TargetBox are registered trademarks and The MathWorks, the L-shaped membrane logo, and Embedded MATLAB are trademarks of The MathWorks, Inc.