MATLAB: Writing to a CSV file

cell array

So I wrote some code and need to output my variables, that are in a cell array, to a csv file. The code below shows how I attempt to do it, but I get the error of, "function is not defined for 'cell' inputs."
fid = fopen('Masonry.csv', 'w');
for n = 1:numel(numberRows)
fprintf(fid, '%s', NameofTypeMasonry(n));
fprintf(fid, '%s', CountryofTypeMasonry(n));
fprintf(fid, '%s', CityofTypeMasonry(n));
fprintf(fid, '%d', HeightofTypeMasonry(n));
end
does anyone have any idea how to fix this?

Best Answer

Possibly you just need to use cell array indexing:
fid = fopen('Masonry.csv', 'wt');
for n = 1:numel(numberRows)
fprintf(fid, '%s', NameofTypeMasonry{n});
fprintf(fid, '%s', CountryofTypeMasonry{n});
fprintf(fid, '%s', CityofTypeMasonry{n});
fprintf(fid, '%d', HeightofTypeMasonry{n});
end
fclose(fid)