Why am I getting this The initial magnification of the image is set to 'fit' in a docked figure MATLAB error - matlab

I am following this project https://github.com/janstenum/GaitAnalysis-PoseEstimation. I have ran the first command and made it all the way through until I ran into this error:
Warning: The initial magnification of the image is set to 'fit' in a docked figure.
> In imshow (line 322)
In extractScaling_openpose (line 21)
In OpenPoseGaitAnalysis_JS (line 11)
This occurs when it reaches the point in which it needs to run the command
calculate_gaitParameters_jointAngles.m
I have tried rereading the documentation with no result and saving the output and individually running the command on it.
I also tried jsut running the entire sequence through with the initial command
OpenPoseGaitAnalysis_JS
It would end and print that error after I tapped save after it ran the function
extractScaling_openpose
I have no idea whats going on. Please help.

Related

Save figure by using MATLAB Command Window

I want to generate a figure and save it by using the MATLAB Command Window, after open it by a shell command from VBA.
The following error message is displayed when I try to open a figure:
In my MATLAB code I am using the following lines, to save the figure:
figure('Visible','off');
imagepath = 'myPath.jpg';
plot(1:100);
saveas(gcf,imagepath);
close(gcf);
Has anyone an idea or some experience with that kind of problem?
Thank you
The problem is you're saving something that's not your figure...
gcf=figure('Visible','off');
should do the trick...

Matlab - Figure Automatically Resizes (gui_mainfcn)

I've built a GUI, and on startup (OpeningFcn), I maximize it (by setting position to [0 0.0463 1 0.8958]). However, when the GUI loads, its position changes (shifts a little to the right, and downwards).
Using debug, I've traced the line of code which does the resizing:
if ~gui_Exported
gui_hFigure = local_openfig(gui_State.gui_Name, 'reuse',gui_Visible);
in the gui_mainfcn function, which comes after OpeningFcn is done executing.
Can someone explain to me what does this code means, and how can I prevent it from resizing my figure on startup?

error in vessel branch segmentation code

I am struggling with this problem since 2 days. Please help me out on this. I am working on vessel branch segmentation and I have got the code from MathWorks central.
Please download the submission from that site, and open the readme.txt
Before I got an error for converting tiff file to mat file but now it's working. Thank you for the quick reply to my post. But now I am getting the following error
Elapsed time is 0.987052 seconds.
Index exceeds matrix dimensions.
Error in VBSvesselMask (line 20)
meanImg=mean(single(orgImg(:,:,windowSize+1:30)), 3);
Error in VesselBranchSegmentation/CBestimateVesselMask (line 294)
[appImg masks(1).img]= VBSvesselMask(orgImg);
Error while evaluating uimenu Callback
Please help me out.
Use dbstop if error and check the size of orgImg at that point.
It seems the input is expected to be some sort of image stack (3D data or a stack of 2D images, such as a set of 2D images of the same area taken over time). The error indicates that the size of your input image is smaller than what the code expects.
This line of code is the sticking point:
orgImg(:,:,windowSize+1:30)
For this to work, the size of third dimension of orgImg must be at least 30 and the value of windowSize should be appropriately set (somewhere between 0 and 29). Looking at the original code, it appears you are supposed to use the VBSreadtiff function on a entire directory of images, to create an image stack for the code to work on. Using a single grayscale or RGB image will not work.

get(0,'screensize') giving result [0 0 1 1] instead of actual pixels

During MATLAB-sessions,get(0,'screensize') first gives the correct resolution. Later on, the answer will become [0 0 1 1] though. This behaviour will only stop when I restart matlab, it is then the correct value again.
This error always happens when I run a specific part of our programme. It appears to happen after this specific line of code:
set(0,'PointerLocation',[.4*GUI.scrsz(3),.5*GUI.scrsz(4)],'units','normalized');
Even though I managed to isolate the error I can´t to figure out the reason for this behaviour. I am using MATLAB R2010b on Windows 7 64bit.
Please note that I´m not an advanced user of MATLAB, so please forgive me if i overlooked something obvious.Thanks in advance for your help.
The reason is that you set 'units' to 'normalized'. And your screen starts naturally in a corner -> [0 0 ... and fills the whole screen -> ... 1 1] (The first pair defines the position and the second pair height and width)
So the values are correct, just not showing the pixels anymore.
Just set it back to set(0,'units','pixels') after you finished the task before, which needed the normalized units. Or store your screensize at the beginning of your script in a variable to use it later on.
With get(0,...) you are getting default properties and with set(0,...) you change them, thats why it's normal again after restart, because Matlab is setting all values to default with every start, which is in your case 'units','pixels'.

In MatLab, how to adjust the line width drawn by the function 'gplot'?

As the help document of Matlab saying, we can use gplot in such a form as
gplot(A,Coordinates,LineSpec)
But when I try to modify the linewidth of the line and use a code like
gplot(A,Coordinates,'linewidth',2)
an error occurred and the error information saying that Error using gplot:
Too many input arguments.
I was wondering if their is anything wrong with my code.
Building on the answer of PearsonArtPhoto, the lines can be modified if they are explicitly found using findall(gcf,'type','line').
This is a working example:
k = 1:30;
[B,XY] = bucky;
gplot(B(k,k),XY(k,:),'-*')
set(findall(gcf,'type','line'),'LineWidth',5)
axis square
which produces the following figure
You could always do it manually. Try doing this right after plotting your figure.
set(gco,'LineWidth',2)