5

フィギュアのouterpositionプロパティを特定のハンドルを持つフィギュアに割り当てる方法はありますか?

たとえば、図を図1のように定義したい場合は、次を使用します。

 figure(1)
 imagesc(Arrayname) % I.e. any array

コードを使用して、フィギュアのプロパティを変更することもできます。

figure('Name', 'Name of figure','NumberTitle','off','OuterPosition',[scrsz(1) scrsz(2) 700 700]);

図1として割り当てられた図にouterpositionプロパティを割り当てるために使用できるプロパティ名はありますか?

これを尋ねる理由は、(MATLABファイル交換からの)save2wordというコマンドを使用して、作成した関数のプロットをワードファイルに保存しているためです。また、開いている図の数を制限したいためです。これを行います。

私が持っている残りのコードは次のとおりです。

plottedloops = [1, 5:5:100]; % Specifies which loops I want to save


GetGeometry = getappdata(0, 'GeometryAtEachLoop') % Obtains a 4D array containing geometry information at each loop


NumSections = size(GetGeometry,4); %Defined by the fourth dimension of the 4D array

for j = 1:NumSections
    for  i = 1:plottedloops
    P = GetGeometry(:,:,i,j);

    TitleSize = 14;
    Fsize = 8;
    % Save Geometry

    scrsz = get(0,'ScreenSize'); %left, bottom, width height   


  figure('Name', 'Geometry at each loop','NumberTitle','off','OuterPosition',[scrsz(1) scrsz(2) 700 700]); This specifies the figure name, dims etc., but also means multiple figures are opened as the command runs.

% I have tried this, but it doesn't work:
% figure(0, 'OuterPosition',[scrsz(1) scrsz(2) 700 700]);

    imagesc(P), title('Geometry','FontSize', TitleSize), axis([0 100 0 100]);

    text(20,110,['Loop:',num2str(i)], 'FontSize', TitleSize); % Show loop in figure
    text(70,110,['Section:',num2str(j)], 'FontSize', TitleSize);% Show Section number in figure

    save2word('Geometry at each loop'); % Saves figure to a word file

end

終わり

ありがとう

4

2 に答える 2

3

フィギュアの作成時にフィギュアのハンドルをキャプチャした場合

figH = figure;

プロパティはいつでも割り当てることができます

set(figH,'OuterPosition',[scrsz(1),scrsz(2),700,700]);

ベクトル内に Figure ハンドルを集めて、一度にすべてのサイズを設定することもできます。

何らかの理由で Figure ハンドルを取得できない場合は、 を使用findallして特定の名前の Figure を探すかgcf、現在の (最後に選択/開いた) Figure のハンドルを取得できます。

于 2010-04-07T14:31:12.933 に答える
0

ここにいくつかの提案/修正があります:

  • 2番目のforループは次のようになります。

    for i = plottedloops
    

    これは、plottedloopsすでに配列でありi、ループを通過するたびに配列内の各順次値を取得する必要があるためです。たとえば、forループの一般的な形式は次のとおりです。

    for i = 1:someScalarValue
    

    用語があなたのために配列を1:someScalarValue 作成するところ。

  • フィギュアウィンドウに何かをプロットし、それをで保存し、次に何かをプロットし、それを保存したいようです。したがって、forループの外側save2wordにフィギュアウィンドウを作成し、ウィンドウの内容を再プロットすることをお勧めします。ループ。これらの2行をループの外側に移動すると、次のようになります。

    scrsz = get(0,'ScreenSize'); %left, bottom, width height   
    figure('Name', 'Geometry at each loop','NumberTitle','off',...
           'OuterPosition',[scrsz(1) scrsz(2) 700 700]);
    

    次に、一度に1つのフィギュアのみを開く必要があります。

于 2010-04-07T16:28:58.127 に答える