1

i have a data type cell that produce from analysis discriminant from matlab, i want use it in GUI..

the result from analysis discriminant can we sa like this: if i have picture and then i use image processing, so i can say every object like this:

A : 'good'
B : 'bad'
C : 'good'
D : 'bad'
E : 'good'

first, how can i calculate how many 'good' and how many 'bad'?

second, when i browse the other picture, how can i cumulative the number of 'good' dan 'bad' from picture 1 and picture 2?

Amro
  • 123,847
  • 25
  • 243
  • 454
saut
  • 21
  • 4

1 Answers1

1

Your question is not very clear... To answer the first part, use TABULATE:

>> ratings = {'good','bad','good','bad','good'};
>> tabulate(ratings)
  Value    Count   Percent
   good        3     60.00%
    bad        2     40.00%
Amro
  • 123,847
  • 25
  • 243
  • 454
  • thanks very much the first part really solve my problem..the second part is when i use in GUI,i browse like nut picture then use image processing i can classify from discriminant analysis 'good' or 'bad'..but how can i acumulate the number of 'good' and 'bad' if i browse more than one picture...'good' and 'bad' in cell type...thanks very much – saut Jun 16 '12 at 03:59
  • if you don't mind may ask one more question..if i have 5 type of cell or char like this : A = {'good'} B = {'good'} C = {'bad'} D = {'bad'} E = {'good'} how i can use colon (:) in function 'if' and calculate the number from A until E...thanks – saut Jun 16 '12 at 04:26
  • @saut: I believe what you need is to create a cell array: `r = cell(5,1);` then fill it inside a loop using the result of discriminant analysis: `for i=1:5, r{i} = '...'; end`. That way you can call TABULATE on array when done – Amro Jun 16 '12 at 16:07
  • oke thanks...really solve my problem..if you don't mind..in GUI how can i show in multi line text,because whe i put it in edit text in command window show Warning: Single line Edit Controls can not have multi-line text ..thanks a lot – saut Jun 16 '12 at 16:15
  • @saut: check this other answer of mine: [What is the best way to display a large text file in MATLAB GUIDE?](http://stackoverflow.com/a/7932849/97160) – Amro Jun 16 '12 at 16:17
  • my input is cell,when i try, command window shows Undefined function or method 'eq' for input arguments of type 'cell'..my input is the total from cell what i asked you before... – saut Jun 16 '12 at 16:43
  • @saut: I'm not sure I follow. Please edit your question and post the code you have tried so far... – Amro Jun 16 '12 at 16:49
  • i do like what you linked to me...but i change fid = fopen( fullfile(matlabroot,'license.txt') ); with fid = fopen( fullfile(matlabroot,X) ); X is the total from cell like this : jumlah={jumlah1{:},jumlah2{:},jumlah3{:},jumlah4{:},jumlah5{:},jumlah6{:},jumlah7{:},jumlah8{:},jumlah9{:}} and tabulate : X=tabulate(jumlah)...what i need is to show variable x in multi text line GUI.. – saut Jun 16 '12 at 17:08
  • @saut: that doesn't make sense (in the other example the content was read from a file)... If you are just getting started with MATLAB, you should really spend some time reading a tutorial/book. It would be more productive for you to start by learning the basics of the language. – Amro Jun 16 '12 at 17:21
  • You're right,i really new with Matlab..but i don't have enough time more,this month i must finish this program...i really need your help,oke let's make it simple...like your first answer to me using tabulate, how to show it in GUI...thanks – saut Jun 16 '12 at 17:32
  • @armo please help me...now iwant to ask how to acumulative data ini GUI...like cashier machine when i scan first stuff and scan second stuff i can get the acumulative price from first stuff and second stuff – saut Jun 20 '12 at 07:38
  • how can i plotting a group data like using gscatter(x,y,group,clr,sym,siz) but i want to use it with 3D... i tried `gscatter(x,y,z,group,clr,sym,siz) but it doesn't work... when i use scatter3(x,y,clr,sym,siz) it can't use the group...please help..thanks – saut Jul 06 '12 at 06:34