Effacer les filtres
Effacer les filtres

convert cell array to tiff?

3 vues (au cours des 30 derniers jours)
Enyinnaya Nwaiwu
Enyinnaya Nwaiwu le 23 Juil 2016
I have pre-processed my netcdf file to extract a specific variable (global CO2 coverage). however the result is a cell array of 1 row and 31 columns and each column is a 97*96 matrix but i need to convert this to a tiff file and i have no idea how to accomplish this. i have attached the matlab script which i have used so far to help understanding, the netcdf file itself is >300mb but a link to onedrive is provided.
netcdf file (global co2 for january 2011): download here
appreciate the help.

Réponses (1)

Vandana Rajan
Vandana Rajan le 8 Août 2016
Hi,
If we assume that the size of the tiff file you need is a 97 X 2976 (97*96 = 2976), then first convert the cell to a matrix and then make a tiff file using the imwrite function.
%%creating a random cell array
c = cell(1,31);
for i = 1:31
c{1,i} = rand(97,96);
end
%%converting cell to matrix first and writing the matrix to a .tiff file
m = cell2mat(c);
imwrite(m,'out.tiff');
im = imread('out.tiff');
imshow(im);
This code will result in an image of size 97 X 2976

Community Treasure Hunt

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

Start Hunting!

Translated by