getting the error :Error using ' Transpose on ND array is not defined.:', in the following codelines..pls help.
1 次查看(过去 30 天)
显示 更早的评论
fprintf(f, 'P5\n%d\n%d\n255\n', cols, rows); fwrite(f, img', 'uint8');
0 个评论
采纳的回答
Roger Stafford
2013-9-1
Apparently the array img has more than two dimensions, so writing its transpose is not well-defined. I would guess its third dimension represents its three colors, red, green, and blue.
Whereas a two-dimensional array has only one other way to rearrange its two dimensions, a three-dimensional array, for example, has five other ways. The matlab command for doing this is appropriately called 'permute', there being as many ways of arranging n dimensions as there are permutations on the numbers from 1 to n. You will have to decide just what it is you wish to happen to the dimensions of img in your fwrite command.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Logical 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!