function write_experimental_data(fname,header_line,format_str,data)
fid=fopen(fname,'w+');

len=zeros(length(header_line),1);
for k=1:length(header_line)
    str_len=length(header_line{k});
    len(k)=str_len+3;
    fprintf(fid,['%' num2str(len(k)) 's'],header_line{k});
end
fprintf(fid,'\n');

for ii=1:size(data{1},1)
    for k=1:length(header_line)
        str=sprintf(format_str{k},data{k}(ii,:));
        if len(k)<length(str)+3
            len(k)=length(str)+3;
        end            
        fprintf(fid,['%' num2str(len(k)) 's'],str);
    end
    if ii<size(data{1},1)
        fprintf(fid,'\n');
    end
end

fclose(fid);