how to create a table in matlab to list my results in without the need to run the program each time to get the results and plot

i ran the same program twice in two cases to get the value of SNR & BER and i got two list of values for each .. how can i apply it in a runnable table plz?

 Accepted Answer

Maybe you can create an M x N matrix to store the result of M values of SNR for each of N experiments. So, for example, you could pre-allocate:
M = size(snr,2);
N = ...
errorCount = zeros(M,N);
...
...
ber = errorCount/I;
...
...
HTH.

2 Comments

I want to recall M different values of SNR and M different values for BER from two different programs. I want to use them to drow two curves
So that means N = 2, and you can use the method that I proposed in my answer above. Does that make sense to you? If not, what specifically is not clear?

Sign in to comment.

More Answers (2)

What is a "runnable table"? What does "apply" mean? If you want to save variables from a run of your program, you can use the save() function. If you need to recall them into another run of your program, you can use the load() function. If you want to have a table, you can use the uitable() function or GUIDE to create a grid/table. Beyond that, I have no more guesses about what you mean.

4 Comments

I mean if i have the program below
l=100000;
nni=randn(1,l);
si=randsrc(1,l,[+1,-1;.5,.5]);
snr=[0:15];
for i=1:16
errorcounter=0;
stdn=sqrt(10^(-snr(i)/10))
ni=nni*stdn;
for m=1:l
ri(m)=ni(m)+si(m);
if ri(m)>0
sdi(m)=1;
elseif ri(m)<=0
sdi(m)=-1;
end
if sdi(m)~=si(m)
errorcounter=errorcounter+1;
end
end
ber(i)=errorcounter/l
end
semilogy(snr,ber) xlabel('snr db');ylabel('ber');grid;
and i want to record its variable values in a table how can i do that?? so i can get the plot by using the table values?
I don't have randsrc() so I can't run your program. You can use uitable() to create a table, then do something like
set(handleToYourTable, 'Data', yourMatrix);
I want to recall M values of SNR and M values of BER from two different programs so this didn't work

Sign in to comment.

Please take a look at this self-paced tutorial:
It will answer this question along with many others that you may have.

Categories

Find more on Programming in Help Center and File Exchange

Tags

No tags entered yet.

Asked:

on 27 Dec 2012

Community Treasure Hunt

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

Start Hunting!