First of all, I went ahead and reworked the messy goto-crap (or I am trying at least right now).
However, now that I am working on those, I get two problems, both of them I have no clue why they even happen.
Right now, when I plot all graphs using the new functions, as long as I don't define an axis before the function actually plots them, the graphs are cut short randomly and at different points:First of all, I went ahead and reworked the messy goto-crap (or I am trying at least right now).
However, now that I am working on those, I get two problems, both of them I have no clue why they even happen.
Right now, when I plot all graphs using the new functions, as long as I don't define an axis before the function actually plots them, the graphs are cut short randomly and at different points:
This would also happen if I define my axis before the plot of the graph function. It just won't be noticeable until I move the plot around.
Why do these graphs not go all the way? And why do they stop at different points?
As I understand it, the axis limits don't result in the graphs being plotted differently. And, as I remember from other codes I've written, that's not the case.
Also, am I right to assume that I should open a new question every time, instead of asking as follow-ups on my first one?
Thank you
ttest is the file with the normal script.
%%% Normal Script
%% First section is just vector definition
InputCheckFinished=1;for InputCheck=1:1:InputCheckFinished;answer = inputdlg('How many X are plotted?:',... 'Sample', [1 50]); NofRepeatsX= str2double(answer{1});answer = inputdlg('How many Y are plotted?:',... 'Sample', [1 50]); NofRepeatsY= str2double(answer{1});endfor j=1:1:NofRepeatsX answer = inputdlg('Enter x-Vector with spaces line by line, 1 iteration=1 vector later on:',... 'Sample', [1 100]); x_Vector= str2num(answer{1}); matx(j,:)=x_Vector j=j+1; endfor j=1:1:NofRepeatsY answer = inputdlg('Enter y-Vector with spaces line by line, 1 iteration=1 vector later on:',... 'Sample', [1 100]); y_Vector= str2num(answer{1}); maty(j,:)=y_Vector j=j+1;endclear answer%% second section is calling the fit and plot functions/defining axis
close all [NumRows,NumCols]=size(maty);clear NumColshold onfits=LPfitfun(matx,maty,NumRows)hold onaxis([-10 10 -10 10])plotfunction_betaaxis([-10 10 -10 10])%hold on
%% third section: the fit function (not the same script as section 1/2)
function [fits] = LPfitfun(matx,maty,NumRows)%LPfitfun Summary of this function goes here
% compute a LPfit for inputs matx,maty,fittype poly1
for k=1:1:NumRows hold on fits{k}=fit(matx(k,:)',maty(k,:)','poly1') hold on endend%% fourth section: the plot function that is not a function. I cant get the actual function to work (see last section) (not the same script as section 1/2)
fits=LPfitfun(matx,maty,NumRows) %fits is the name of the cell in which all fits are stored. the string
%LPfitfun(matx,maty,Numrows) takes these
hold onfor k=1:1:NumRows hold on axis() plot(fits{1,k},'') hold on plot(matx(k,:),maty(k,:),'o') hold onenddisp('DONEBeta')%% fifth section: the actual plot function that is not working
function[LPplotfun]=LPplotfun(matx,maty,fits,NumRows)%LPplotfun plots all LPfitset up by LPfitfun
hold on for k=1:1:NumRows hold on plot(fits(1,1),'') hold on plot(matx(k,:),maty(k,:),'o') hold on pause(3) hold offendhold ondisp('Doneplotfun')end%% Error message when trying to plot using LPplotfun:
Not enough input arguments.Error in LPplotfun (line 4)for k=1:1:NumRowsError in ttest (line 190)LPplotfun% I know this is a bit of a problem- and code-dump. I am not seeing the problem right now.
Best Answer