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: plot_obs_spa_for_ranks.m
    path of file: ./repos/mctc4bmi/algs_tc/RLRT/rpca
    
    the code of the file until where you have to start completion: function stats = plot_obs_spa_for_ranks( fig_ind, saveResults )
% plot obs % vs corruption % for a few ranks

load ..\..\data\syn-lr-tnames   % load tnames

marker = { 'r-*', 'b-*', 'k-*', 'g-*' };
Ntens = length(tnames);
Itens = [ 1,2,3 ];      
Ntens = length(Itens);
Nobs = 20;
Nnoise = 9;
Nrep = 1;
Imag = 1;
alg = 2;
rRatio = 1;
lambdaS = 1;
IsTC = true;
verbose = false;
err_bar = 0.01;

stats.obs = [];
stats.spa = zeros( Ntens, Nobs );
stats.exp = 'obs-spa-for-ranks';

figure( fig_ind );

for t = 1:Ntens

    
function stats = plot_obs_spa_for_ranks( fig_ind, saveResults )
% plot obs % vs corruption % for a few ranks

load ..\..\data\syn-lr-tnames   % load tnames

marker = { 'r-*', 'b-*', 'k-*', 'g-*' };
Ntens = length(tnames);
Itens = [ 1,2,3 ];      
Ntens = length(Itens);
Nobs = 20;
Nnoise = 9;
Nrep = 1;
Imag = 1;
alg = 2;
rRatio = 1;
lambdaS = 1;
IsTC = true;
verbose = false;
err_bar = 0.01;

stats.obs = [];
stats.spa = zeros( Ntens, Nobs );
stats.exp = 'obs-spa-for-ranks';

figure( fig_ind );

for t = 1:Ntens
    tname = tnames{Itens(t)};
    load( ['..\..\data\',tname] );
    maxNoise = Nnoise;
    
    for i = Nobs:-1:1
        
        for j = maxNoise:-1:1
            err = zeros( 1, Nrep );
            for k = 1:Nrep
                dtemp = gen_syn_data( data, i, j, Imag, k );
                results = test_trpca( dtemp, alg, rRatio, lambdaS, IsTC, verbose );
                err(k) = results.rel_err1;
            end