You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: greedy.m
    path of file: ./repos/opt_matlab/第7章/例7.1
    
    the code of the file until where you have to start completion: function [y,val]=greedy(f,A,b,I)    %背包问题的贪心算法，

    
function [y,val]=greedy(f,A,b,I)    %背包问题的贪心算法，
%%　f,A分别为价值和体积，b为约束条件,I是已确定的变量序号及对应的取值
if nargin==3
    I=[];
    n=length(f);
    ratio=f./A;
    a1=[];
end