×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

problem with axes

problem with axes

problem with axes

(OP)
In the following example i am creating a figure and adding an axes to it. i want to do a quiver plot on the created axes. for this i am setting current axes to the created axes. But when i am calling quiver it is being plotted on a automatically created axes. please let me know what could be the problem.

h_figure = figure('Units','characters',...
    'Position',[49.8000   13.4615  120.0000   35.0000],...
    'Color',get(0,'DefaultUicontrolBackgroundColor'),...
    'HandleVisibility','callback');
h_axes = axes('Units','characters',...
    'Position',[10 4.5 72 26],...
    'Parent',h_figure,...
    'XLim',[-100,100],...
    'YLim',[-100,100]);

strFilename = 'FOT024-03_FOT030-01_Jan_04';

% init file parameter
nHeaderLines = 12;

% open file channel
[fid,strMessage] = fopen(strFilename,'r');

% error handling
if fid < 1
    disp(strMessage)
    return
end

% loop over lines
iLine = 0;
iData = 0;
WNo = 0;
while ~feof(fid)
    strLine=fgetl(fid);
    iLine = iLine + 1;   
    % continue reading header
    if iLine <= nHeaderLines, continue,  end

    % break if empty line
    if isempty(deblank(strLine))
%       break
        if ~exist('data'), break, end
        WNo = WNo+1;
        TD(1,WNo)={data};
        iLine = 1;
        nHeaderLines = 9;
        iData = 0;
        clear data;
        continue,
    end
    
    % data section
    iData = iData + 1;
    %example data line     
    %M0 2    1     7.833   -7.770   0.0113  -0.0163  PASS
    
    % converting data line to numeric datatypes
    try,
        data(iData,1:6) = sscanf(strLine,'%*s %d %d %g %g %g %g %*s')';
    catch,
        break,
    end
    
end


lineSpec=['-r';'-b']
for i=1:length(TD)
    data = cell2mat(TD(i));
    Wy=data(:,1);
    Wy=data(:,2);
    Gx=data(:,1)*26;
    Gy=data(:,2)*32;
    Sx=data(:,3);
    Sy=data(:,4);
    Dx=data(:,5);
    Dy=data(:,6);
    axes(h_axes)
%     hold on;
    quiver((Gx+Sx),(Gy+Sy),Dx,Dy,lineSpec(i,:))
end
fclose(fid);

RE: problem with axes

Hi kollurulp.

This might sound silly - and sorry if you've tried this already, but it looks like you have commented out the "hold on" command.  Another thing you could try is replacing the semi colon after it with a comma, or removing it altogether.

Char

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members! Already a Member? Login


Resources

Low-Volume Rapid Injection Molding With 3D Printed Molds
Learn methods and guidelines for using stereolithography (SLA) 3D printed molds in the injection molding process to lower costs and lead time. Discover how this hybrid manufacturing process enables on-demand mold fabrication to quickly produce small batches of thermoplastic parts. Download Now
Design for Additive Manufacturing (DfAM)
Examine how the principles of DfAM upend many of the long-standing rules around manufacturability - allowing engineers and designers to place a part’s function at the center of their design considerations. Download Now
Taking Control of Engineering Documents
This ebook covers tips for creating and managing workflows, security best practices and protection of intellectual property, Cloud vs. on-premise software solutions, CAD file management, compliance, and more. Download Now