help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

"some elements in return list undefined" but only when executed from a s


From: Jeff
Subject: "some elements in return list undefined" but only when executed from a script
Date: Sat, 20 Jul 2013 21:57:18 -0400

When I run the following script, I get the error "warning: plotFPU: some elements in list of return values are undefined". However, I can assure you that plotFPU is valung both return values (I don't need the second one for this script). However, if I type the plotFPU command by hand, without the trailing semicolon (;), it works (though I get a lot of output I don't want). Why doesn't this work with a semicolon on the end?

I even tried (temporarily) rewriting it so that plotFPU only passes back one variable, h, and makeGraphs only receives one variable? Still no luck.

makeGraphs.m
clear; more off;

for p = 4:7
  tic; initFPU_2D; toc;
  tStep = 0;
  src   = '/raid/fpuData/';
  tgt   = '/raid/fpuData/graphs/';
  ftype = '.U.csv';
  for beta = 0:100:2000
    for pTol = 8

      % Read the solution file
      fn = sprintf('N=%03dx%03d_Beta=%04d_tol=1e-%02d_t=%07d', N, N, beta, pTol, tStep);
      fprintf('Loading %s:\t', [fn ftype]);
      tic; u1 = csvread([src fn ftype]); toc;

      % Transform to fourier space
      [U,Udot,W,Wdot] = xformFPU(u1, F);

      % Plot it
      fn = sprintf('%s%s', tgt, fn);
      fprintf('Creating flie: %s\t', fn);
      [h,dummy]=plotFPU(N, 'Fixed', beta, D, W, Wdot);
      print (h, fn, "-dpdf"); toc;

    end
  end
end

plotFPU.m (5th and 6th lines set return values)
function [h, Hn_f] = plotFPU(N, boundary, beta, D, W, Wdot)

  repD = repmat(D,[size(W,1),1]);
  Pn_f = (W.^2).*(repD./N);
  Qn_f = (Wdot.^2)./N;
  Hn_f = Pn_f + Qn_f;

  h=figure(2);
  clf; hold on;
  col=1;
  plot(Hn_f(:,col),'b-');
  if N/2 >= 4, plot(Hn_f(:,col+2),'r-'); end
  if N/2 >= 6, plot(Hn_f(:,col+4),'g-'); end
  if N/2 >= 8, plot(Hn_f(:,col+6),'k-'); end
  axis tight;
  strTitle = 'Energy per Mode (N=%d, Beta=%.d, %s BC)';
  strTitle=sprintf(strTitle, N, beta, boundary);
  title(strTitle,'FontSize',12);
  xlabel('Time');
  ylabel('Energy');
  hold off;
end

reply via email to

[Prev in Thread] Current Thread [Next in Thread]