Error using cat. Dimensions of arrays being concatenated are not consistent.
Show older comments
Hi everybody,
i'm trying to import an ascii file in matlab and change comma with point. I'm using this code found in the community. It give me an error "Error using cat. Dimensions of arrays being concatenated are not consistent.". I should have a 7013x10139 double.
I don't know how to fix it. Any help? The file is attached here.
fid = fopen('zero_mac_cluster1.asc', 'rb');
strings = textscan(fid, '%s', 'Delimiter', '');
fclose(fid);
decimal_strings = regexprep(strings{1}, ',', '.');
data = cellfun(@str2num, decimal_strings, 'uni', 0);
zero = cat(1, data{:});
zero(zero == -9999) = NaN;
Accepted Answer
More Answers (0)
Categories
Find more on Tables 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!