From: Jeremy on 9 Mar 2010 05:48 I want to use fprintf to display an output with a string, I have that part working fine but below it still says ans=..... Is there a way to supress this since I'm already getting what I want in the fprintf fprintf(1,'This is the monthly payment $%-7.2f \n',garbage) and I get This is the monthly payment $xxxx.xx ans=xxxx.xx <<< what I don't want :) Thanks in advance
From: Rune Allnor on 9 Mar 2010 05:52 On 9 Mar, 11:48, "Jeremy " <arroyo_000...(a)hotmail.com> wrote: > I want to use fprintf to display an output with a string, I have that part working fine but below it still says ans=..... Is there a way to supress this since I'm already getting what I want in the fprintf > > fprintf(1,'This is the monthly payment $%-7.2f \n',garbage) > > and I get > This is the monthly payment $xxxx.xx > ans=xxxx.xx <<< what I don't want :) > Thanks in advance This has nothing to do with the FPRINTF statement. Did you forget a semicolon at the end of some other line? Rune
From: us on 9 Mar 2010 05:57 "Jeremy " <arroyo_000021(a)hotmail.com> wrote in message <hn5913$9qf$1(a)fred.mathworks.com>... > I want to use fprintf to display an output with a string, I have that part working fine but below it still says ans=..... Is there a way to supress this since I'm already getting what I want in the fprintf > > fprintf(1,'This is the monthly payment $%-7.2f \n',garbage) > > and I get > This is the monthly payment $xxxx.xx > ans=xxxx.xx <<< what I don't want :) > Thanks in advance using FPRINTF, this does not happen here (r2010a)... it only happens with SPRINTF, of course... which ML ver do you use(?)... us
From: Jeremy on 9 Mar 2010 06:58 function [Payment] = Mortgage( Price ) %This will calculate a mortgage based on your selected input. %You will be prompted to enter amounts for mortgage, interest, and term. %To enter Mortgage amount correctly, enter amount in dollars with no commas %ex. 100000 for $100,000 you can enter change if desired %To enter interest rate correctly enter 5.575 for 5.575% not .0575 %To enter term correctly type in the number of years you wish to have the %loan ex. 30 %Created by Jeremy Goff 3/1/10 clc format bank disp(' ') disp('Follow these steps to calculate a monthly payment') disp(' ') Home_Cost=input('Input Home Cost $'); disp(' ') down_payment=input('Input down payment (optional) $'); disp(' ') Interest_Rate=input('Input Interest Rate As % ')/100; disp(' ') Years=input('Input Number Of Years Desired For Financing '); disp(' ') Payment=((Home_Cost-down_payment).*(Interest_Rate./12)./(1-(1+(Interest_Rate./12)).^-(Years.*12))); disp(' ') fprintf(1,'The monthly payment is $%-7.2f \n',Payment); %UNTITLED Summary of this function goes here % Detailed explanation goes here end this is a copy of what im running, and im getting ans= but in a different m file im not, i cant see whats different in the two of them either im pulling my hair out anyone???
From: Jeremy on 9 Mar 2010 07:01
freaky! i just happened to highlight and run selection, it worked, but if i run the file it doesnt! SOMEONE HELP. also im using 7.8.0 (r2009a) (student) |