フィルターのクリア

changing a number in calculation with if else or anything possible

1 回表示 (過去 30 日間)
amir khalighi
amir khalighi 2018 年 4 月 16 日
コメント済み: amir khalighi 2018 年 4 月 19 日
Hi all I wrote a code witch is attached , I calculate profit and then rewrite profit in main excel file(2.xls) I have 2 question: 1- I want to change profit to 'c' amount when it is less than 0 and if if it>=0 then profit=the amount witch we calculated before 2-I want to draw the diagram in excel based on 's'(as X) and 'profit'(as Y) how can I do it? thank you all
  1 件のコメント
amir khalighi
amir khalighi 2018 年 4 月 19 日
please if anyone knows about it tell me :(

サインインしてコメントする。

採用された回答

KSSV
KSSV 2018 年 4 月 19 日
data=xlsread ('2') ;
k=data(1) ;
c=data(2) ;
s_no=length(data(:,2)) ;
s=data(2:s_no,2) ;
profit=s-k-c ;
% Change profit to c when < 0
profit(profit<0) = c ;
plot(s,profit) ;
xlabel('s') ;
ylabel('profit') ;
xlswrite('2',profit,1,'d2')

その他の回答 (0 件)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by