From: Alex Larcombe on
Hi,
I am trying to export data from a plateau fit parameter called "poly_plat" that consists of a slope and and intercept, using the lines:

outfile_plateau = sprintf('%s-plateau.txt',rawtext);
f_plateau = fopen(outfile_plateau,'wt');
fprintf(f_plateau,'BreathNo\tSlope\tIntercept\n');
fprintf(f_plateau,'%d\t%f\t%f\n',[k_breath; poly_plat]);
fclose(f_plateau);

However I am receiving the error:

??? Error using ==> vertcat
CAT arguments dimensions are not consistent.

Error in ==> calc_fowler at 154
fprintf(f_plateau,'%d\t%f\t%f\n',[k_breath; poly_plat]);

How can I check what the dimensions of poly_plat are, and export the data correctly?
Any help would be greatly appreciated.
Alex.
From: Walter Roberson on
Alex Larcombe wrote:

> However I am receiving the error:
>
> ??? Error using ==> vertcat
> CAT arguments dimensions are not consistent.
>
> Error in ==> calc_fowler at 154
> fprintf(f_plateau,'%d\t%f\t%f\n',[k_breath; poly_plat]);
>
> How can I check what the dimensions of poly_plat are, and export the
> data correctly?

size(poly_plat)

You mentioned that poly_plot is two elements. It is probably 1 x 2, which is
inconsistent with vertical concatenation (via the semi-colon in the list) of
the 1 x 1 scalar k_breath. To be safest, change it to poly_plat(:) and then
the orientation won't matter.
From: Alex Larcombe on
Thanks for the reply. When I make the change you suggest, I get the error

??? Undefined function or variable "poly_plat".

Even though I have poly_plat defined earlier in the code as

poly_plat = polyfit(volume_exp_plat,gas_exp_plat,1);

Thus poly_plat is a row vector of length 2, but I can't get it to work?
Any further ideas?

Walter Roberson <roberson(a)hushmail.com> wrote in message <hogtfs$shm$2(a)canopus.cc.umanitoba.ca>...
> Alex Larcombe wrote:
>
> > However I am receiving the error:
> >
> > ??? Error using ==> vertcat
> > CAT arguments dimensions are not consistent.
> >
> > Error in ==> calc_fowler at 154
> > fprintf(f_plateau,'%d\t%f\t%f\n',[k_breath; poly_plat]);
> >
> > How can I check what the dimensions of poly_plat are, and export the
> > data correctly?
>
> size(poly_plat)
>
> You mentioned that poly_plot is two elements. It is probably 1 x 2, which is
> inconsistent with vertical concatenation (via the semi-colon in the list) of
> the 1 x 1 scalar k_breath. To be safest, change it to poly_plat(:) and then
> the orientation won't matter.
From: ImageAnalyst on
You can learn how to use the debugger. Set a breakpoint at the first
place where you create it, then step along until it becomes undefined/
empty. Most likely you
1) have a "clear" statement in there somewhere, or
2) you're in a different function where that variable is not in scope,
or
3) you have a typographical error.
From: Alex Larcombe on
ImageAnalyst <imageanalyst(a)mailinator.com> wrote in message <02e4059f-3840-47a9-a7fc-9da715d34b33(a)q16g2000yqq.googlegroups.com>...
> You can learn how to use the debugger. Set a breakpoint at the first
> place where you create it, then step along until it becomes undefined/
> empty. Most likely you
> 1) have a "clear" statement in there somewhere, or
> 2) you're in a different function where that variable is not in scope,
> or
> 3) you have a typographical error.

Hi ImageAnalyst,
Thanks for your advice. I have used the debugger and breakpoints to try to answer this problem, but to no avail. I do not have a "clear" statement anywhere in the code, and there is definitely not a typographical error. I am not sure what you mean by comment (2) above. The code is all within the same .m file, however the part that generates poly_plat is within a separate subroutine. I am at a loss as to what to do next.

I am happy to post the full code if you think this might help.