MATLAB Answers

Can anyone tell me how to change the display and storing of the values returned in given form to the form displayed and stored by imhist. Format is given below.

2 views (last 30 days)
radha
radha on 9 Mar 2014
Commented: radha on 10 Mar 2014
In case of imhist program working fine because the pixelCounts(Variable) for them are displayed in this form. Given below....
1
2
3
4
5
like this.And in case of LRBP(My code) pixelCounts(Variable) are displayed like this:
columns 1 to 7
1 2 3 4 5
In this form.
Now I want LRBP form to be displayed in imhist form.
That's Why I am getting subscripted dimension mismatch as error. This what I tried to find out cause of the error.
Now can you please help me to guide what should I change??
So that This error will be resolved.

Accepted Answer

Jan
Jan on 9 Mar 2014
Which code causes the error? Without seeing the code, we cannot guess what you should change. But it looks easy, because all you need to do is to transpose the output:
a = [1,2,3,4,5,6,7];
disp(a)
disp(a.')
% or equivalently: disp(transpose(a))
% or:
b = [1;2;3;4;5;6;7]
  1 Comment
radha
radha on 10 Mar 2014
Actually I want to store the 4 histograms in row wise form in the .matfile using the below code.
%code
clc; clear all;
output = zeros(5, 1024); % Initialize
for k = 1 : 5
% Compute the 4 histograms...
Image=imread(strcat('Temp\',num2str(k),'.jpg'));
[pixelCount1, grayLevels1] = LRBP(1,Image);
[pixelCount2, grayLevels2] = LRBP(4,Image);
[pixelCount3, grayLevels3] = LRBP(16,Image);
[pixelCount4, grayLevels4] = LRBP(64,Image);
disp('pixelCount1');
disp(pixelCount1);
disp('pixelCount2');
disp(pixelCount2);
disp('pixelCount3');
disp(pixelCount3);
disp('pixelCount4');
disp(pixelCount4);
% Stitch together and stick into one row of the array.
output(k,:) = [pixelCount1', pixelCount2', pixelCount3', pixelCount4'];
disp('pixelCount1');
disp(pixelCount1');
disp('pixelCount2');
disp(pixelCount2');
disp('pixelCount3');
disp(pixelCount3');
disp('pixelCount4');
disp(pixelCount4');
end
save('H.mat', 'output');
While doing this I am getting subscripted dimension mismatch error at the line:
??? Subscripted assignment dimension mismatch.
Error in ==> ImLast at 23 output(k,:) = [pixelCount1', pixelCount2', pixelCount3', pixelCount4'];
So I want to solve this error. According to me this was due to this cause which I asked you.
So I transpose it... Still I am getting error.
Can you help me to solve this error.
If you want then I can give .m files for running my code.
Thanks for your response.
Please help to solve this error!!!!!!

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!