convert cell array to tiff?
2 views (last 30 days)
Show older comments
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.
appreciate the help.
0 Comments
Answers (1)
Vandana Rajan
on 8 Aug 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
0 Comments
See Also
Categories
Find more on NetCDF in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!