LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 08-15-2014, 06:30 AM   #1
Redsfan86
Member
 
Registered: Mar 2014
Posts: 36

Rep: Reputation: Disabled
How can I run "filename.m" using MATLAB ?


Hi guys
I installed Matlab "for student version"
it works , as well as my results are ready for figures ....
I have no idea about MATLAP before
how could I run "filename.m" from MATLAP editor ?
what are the commands ...
Important note:I'm using Ubuntu 12.04 (32 bit) , the simulator is
LTE-Sim, the author of the scenario that I'm working on, made the graphic files use MATLAB
Cheers.
Regards

Last edited by Redsfan86; 08-15-2014 at 06:34 AM.
 
Old 08-15-2014, 10:12 PM   #2
John VV
LQ Muse
 
Registered: Aug 2005
Location: A2 area Mi.
Posts: 17,624

Rep: Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651
I use "octave" and not matlab

Octave is a gpl'ed clone of matlab
and is in the ubuntu repos , well every major OS's repos

as to the commands???????
without knowing WHAT the program dose and the variables in it .
there is NO way i can tell
Code:
matlab
filename.m
"filename.m" will likely have some arguments


normally one reads the instructions for the program
and / or
" read the code"
as in read the *.m file
What dose it do ?
what are the arguments?
and so on ....
 
Old 08-16-2014, 02:42 AM   #3
Redsfan86
Member
 
Registered: Mar 2014
Posts: 36

Original Poster
Rep: Reputation: Disabled
thanks a lot
First : I tried to use Octave, but I got errors + the author of the file himself advised me to use MATLAB.
as well as I'm not sure about the codes of octave that I'm used ....
so the first question ...
1- Could you please tell me in details how to execute "anyfilename.m"
Now .. what does the file works ....
First of all , there are many files (.m) I have, not only this one
these files are responsible to generate simulation results figures for scheduling algorithms....
Here are the Full codes (makegrahs.m): this is the file that we have to run ...
Code:
clc;
close all;
clear all;

sched=[1 6 5 4]; % PF; LOG; EXP; FLS
users=[10 20 30 40];
delay=[0.04 0.06 0.08 0.1];
speed=[3 120];


test='PLRVIDEO';
for v=1:length(speed)
for ue=1:length(users)
    for d=1:length(delay)
    for s=1:length(sched)
        dat=load(strcat('OUT/',test,'_SCHED_',num2str(sched(s)),'_UE_',num2str(users(ue)), '_V_',num2str(speed(v)),'_D_',num2str(delay(d))));
        mat(s,d)=mean(dat);
    end
    end
    t=strcat(test,'_SPEED_',num2str(speed(v)),'_UEs_',num2str(users(ue)));
    y='PLR [%]';
    ymax=100;
    ymin=0;
    plotnormal(mat',t, y, ymin, ymax)
end
end

test='TPUTVIDEO';
for v=1:length(speed)
for ue=1:length(users)
    for d=1:length(delay)
    for s=1:length(sched)
        dat=load(strcat('OUT/',test,'_SCHED_',num2str(sched(s)),'_UE_',num2str(users(ue)), '_V_',num2str(speed(v)),'_D_',num2str(delay(d))));
        mat(s,d)=mean(dat);
    end
    end
    t=strcat(test,'_SPEED_',num2str(speed(v)),'_UEs_',num2str(users(ue)));
    y='Goodput [Mbps]';
    ymax=5;
    mat=mat./1000000;
    ymin=0;
    plotnormal(mat',t, y, ymin, ymax)
end
end


test='DELVIDEO';
for v=1:length(speed)
for ue=1:length(users)
    for d=1:length(delay)
    for s=1:length(sched)
        dat=load(strcat('OUT/',test,'_SCHED_',num2str(sched(s)),'_UE_',num2str(users(ue)), '_V_',num2str(speed(v)),'_D_',num2str(delay(d))));
        mat(s,d)=mean(dat);
    end
    end
    t=strcat(test,'_SPEED_',num2str(speed(v)),'_UEs_',num2str(users(ue)));
    y='Goodput [Mbps]';
    y='Packets Delay [s]';
    ymax=100;
    ymin=0.01;
    plotlog(mat',t, y, ymin, ymax)
end
end







test='PLRVOIP';
for v=1:length(speed)
for ue=1:length(users)
    for d=1:length(delay)
    for s=1:length(sched)
        dat=load(strcat('OUT/',test,'_SCHED_',num2str(sched(s)),'_UE_',num2str(users(ue)), '_V_',num2str(speed(v)),'_D_',num2str(delay(d))));
        mat(s,d)=mean(dat);
    end
    end
    t=strcat(test,'_SPEED_',num2str(speed(v)),'_UEs_',num2str(users(ue)));
    y='PLR [%]';
    ymax=20;
    ymin=0;
    plotnormal(mat',t, y, ymin, ymax)
end
end

test='TPUTVOIP';
for v=1:length(speed)
for ue=1:length(users)
    for d=1:length(delay)
    for s=1:length(sched)
        dat=load(strcat('OUT/',test,'_SCHED_',num2str(sched(s)),'_UE_',num2str(users(ue)), '_V_',num2str(speed(v)),'_D_',num2str(delay(d))));
        mat(s,d)=mean(dat);
    end
    end
    t=strcat(test,'_SPEED_',num2str(speed(v)),'_UEs_',num2str(users(ue)));
    y='Goodput [Mbps]';
    ymax=1;
    mat=mat./1000000;
    ymin=0;
    plotnormal(mat',t, y, ymin, ymax)
end
end


test='DELVOIP';
for v=1:length(speed)
for ue=1:length(users)
    for d=1:length(delay)
    for s=1:length(sched)
        dat=load(strcat('OUT/',test,'_SCHED_',num2str(sched(s)),'_UE_',num2str(users(ue)), '_V_',num2str(speed(v)),'_D_',num2str(delay(d))));
        mat(s,d)=mean(dat);
    end
    end
    t=strcat(test,'_SPEED_',num2str(speed(v)),'_UEs_',num2str(users(ue)));
    y='Goodput [Mbps]';
    y='Packets Delay [s]';
    ymax=1;
    ymin=0.001;
    plotlog(mat',t, y, ymin, ymax)
end
end











test='TPUTBE';
for v=1:length(speed)
for ue=1:length(users)
    for d=1:length(delay)
    for s=1:length(sched)
        dat=load(strcat('OUT/',test,'_SCHED_',num2str(sched(s)),'_UE_',num2str(users(ue)), '_V_',num2str(speed(v)),'_D_',num2str(delay(d))));
        mat(s,d)=mean(dat);
    end
    end
    t=strcat(test,'_SPEED_',num2str(speed(v)),'_UEs_',num2str(users(ue)));
    y='Goodput [Mbps]';
    ymax=10;
    mat=mat./1000000;
    ymin=0;
    plotnormal(mat',t, y, ymin, ymax)
end
end
This is the code for createfigure.m
Code:
function createfigure(ymatrix1, t, y, ymax)


figure1 = figure('Name', t);

axes1 = axes('Parent',figure1,'XTickLabel',{'10','20','30'},'XTick',[1 2 3],'FontSize',20);
box(axes1,'on');
grid(axes1,'on');
hold(axes1,'all');

% Create multiple lines using matrix input to bar
bar1 = bar(ymatrix1,'Parent',axes1);
set(bar1(1),'DisplayName','PF');
set(bar1(2),'DisplayName','FLS');
set(bar1(3),'DisplayName','EXP');
set(bar1(4),'DisplayName','LOG');

xlabel('Number of Users','FontSize',20);
ylabel(y,'FontSize',20);
ylim ([0 ymax]);

legend1 = legend(axes1,'show');
set(legend1,...
    'Position',[0.794558608718962 0.753098188751188 0.0997122246143713 0.157112868804529]);

saveas(figure1, t, 'png')
plotlog.m full code
Code:
function plotlog(ymatrix1, t, y, ymin, ymax)
%CREATEFIGURE1(YMATRIX1)
%  YMATRIX1:  bar matrix data

%  Auto-generated by MATLAB on 05-Mar-2013 21:48:14

% Create figure
figure1 = figure('Name', t);

% Create axes
axes1 = axes('Parent',figure1,'YScale','log','YMinorTick','on',...
    'YMinorGrid','on',...
    'XTickLabel',{'0.04','0.06','0.08','0.1'},...
    'XTick',[1 2 3 4],...
    'FontSize',20);
% Uncomment the following line to preserve the Y-limits of the axes
% ylim(axes1,[0.1 100]);
box(axes1,'on');
grid(axes1,'on');
hold(axes1,'all');

% Create multiple lines using matrix input to bar
bar1 = bar(ymatrix1,'BaseValue',ymin,'Parent',axes1);
set(bar1(1),'DisplayName','Proportional Fair');
set(bar1(2),'DisplayName','LOG rule');
set(bar1(3),'DisplayName','EXP rule');
set(bar1(4),'DisplayName','Frame Level Scheduler');

% Create xlabel
xlabel('Target Delay [s]','FontSize',20);

% Create ylabel
ylabel(y,'FontSize',20);

ylim ([ymin ymax])

% Create legend
legend1 = legend(axes1,'show');
set(legend1,'Location','NorthOutside');
saveas(figure1, t, 'png')
Full code for plotnormal.m
Code:
function plotnormal(ymatrix1, t, y, ymin, ymax)
%CREATEFIGURE1(YMATRIX1)
%  YMATRIX1:  bar matrix data

%  Auto-generated by MATLAB on 05-Mar-2013 21:48:14

% Create figure
figure1 = figure('Name', t);

% Create axes
axes1 = axes('Parent',figure1,'YMinorTick','on',...
    'YMinorGrid','on',...
    'XTickLabel',{'0.04','0.06','0.08','0.1'},...
    'XTick',[1 2 3 4],...
    'FontSize',20);
% Uncomment the following line to preserve the Y-limits of the axes
% ylim(axes1,[0.1 100]);
box(axes1,'on');
grid(axes1,'on');
hold(axes1,'all');

% Create multiple lines using matrix input to bar
bar1 = bar(ymatrix1,'BaseValue',ymin,'Parent',axes1);
set(bar1(1),'DisplayName','Proportional Fair');
set(bar1(2),'DisplayName','LOG rule');
set(bar1(3),'DisplayName','EXP rule');
set(bar1(4),'DisplayName','Frame Level Scheduler');

% Create xlabel
xlabel('Target Delay [s]','FontSize',20);

% Create ylabel
ylabel(y,'FontSize',20);

ylim ([ymin ymax])

% Create legend
legend1 = legend(axes1,'show');
set(legend1,'Location','NorthOutside');
saveas(figure1, t, 'png')
These are the files for the graphic ....
according to the author:
Code:
- run simulations:
	sh run.sh

- elaborate simulations' output
	sh postsim.sh

- generate graphs using the makegraphs.m file (using Matlab)
I've done the first two steps , still the figures for me ....
I'v installed octave .... but I got some errors ....
So could you please help me in any way (MATLAB0 or Octave) ..
I don't care , I care about the figures....
thanks a lot
Regards.

Last edited by Redsfan86; 08-16-2014 at 02:48 AM.
 
Old 08-16-2014, 05:28 AM   #4
Redsfan86
Member
 
Registered: Mar 2014
Posts: 36

Original Poster
Rep: Reputation: Disabled
Here I will summarize all my efforts to make this codes working for me using octave
I installed octave using
Code:
sudo get-apt update
sudo get-apt install octave
here I started to try so many times , using different commands ...
I used:
Code:
./makegraphs
I used:
Code:
sudo octave makegraphs.m
I usded:
Code:
octave makegraphs.m
these commands I get from wikis to use..... all of theses commands
didn't work for me, I got different errors depending on the command that I'v used....
the last cammand I used , it was like this:
Code:
cat makegraphs.m
then
Code:
makegraphs
Code:
octave:1> makegraphs
I get a figure this time without any line, only I get x,y
here is the link that I used the previous commands to generate the figures
http://octave.1599824.n4.nabble.com/...td1628403.html
Cheers

Last edited by Redsfan86; 08-16-2014 at 05:30 AM.
 
Old 08-17-2014, 07:31 PM   #5
John VV
LQ Muse
 
Registered: Aug 2005
Location: A2 area Mi.
Posts: 17,624

Rep: Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651
I take it that "LTE-Sim" is installed and worksand is outputing data

the data that the matlab files use
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
flag based Mem usage checking within MATLAB run on linux manants Linux - Newbie 14 02-22-2013 10:40 AM
[SOLVED] Installed MATLAB in /home/c/Desktop/MATLAB But Cannot ACCESS it hitmen Linux - Newbie 10 09-25-2011 12:11 PM
Run an executable file (.exe) from matlab in a linux enviroment mca21138 Linux - Newbie 13 06-24-2011 07:20 AM
Matlab Distributed Computing Server: Connecting to Matlab client fails OEP Linux - Server 0 12-21-2009 02:18 PM
Terminal cmd for starting Matlab M-file editor without starting matlab fubzot Linux - Software 2 02-15-2005 06:49 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 04:21 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration