Search This Blog

2024/10/16

MATLAB - Adding missing launcher in UBUNTU

Add Missing Launcher for MatLab in Ubuntu

Launch Terminal

1.download your own icon-

sudo wget
http://upload.wikimedia.org/wikipedia/commons/2/21/
Matlab_Logo.png -O /usr/share/icons/matlab.png

2.create launcher file
sudo touch /usr/share/applications/matlab.desktop

3.edit launcher file

sudo nano /usr/share/applications/matlab.desktop

4.add following into the launcher file.

#!/usr/bin/env xdg-open
[Desktop Entry]
Type=Application
Icon=/usr/share/icons/matlab.png
Name=MATLAB R2014a
Comment=Start MATLAB - The Language of Technical Computing
Exec=/usr/local/MATLAB/R2024b/bin/matlab -desktop
Categories=Development;

Save & lauch matlab from icon.

Lets write simple script to display triangle as follows

Create Following Script in MatLab& Run.

clc
clear all
close all
x=[0,1,2]
y=[0,1,0]
plot(x,y,'Color','blue','LineWidth',1);
area(x,y,'FaceColor','green');


Now save it & run,IF you got low level graphic error then

cd /usr/local/MATLAB/R2024b/bin

now launch matlab as

./matlab -softwareopengl

Now Try to run script if this time script render
triangle then

In Matlab terminal

opengl('save','software')

This will add prefernces to matlab wrt opengl

Exit & launch Matlab from Launcher instead of command line &
recheck if it is rendering Triangle as previously.

2024/05/20

Running Javascript function from Angular component

 


we can run javascript from angular code on certain event.

For that first create a javascript file inside asset folder.

Mine is located at src/assets/js/selectPickerTrigger.js

Inside this js file add following code

function reRenderSelect(){
alert("I M IN")
}

Go to angular.json file search for script tag & add path to your js file here.

"scripts": [
"src/assets/js/selectPickerTrigger.js"
]

Now go to your name.component.ts file

add following to list of import statements.

import { Component, OnInit, ViewChild, ElementRef } from '@angular/core';
declare function reRenderSelect(): any;

Now you can call our reRenderSelect() function from anywhere in component.ts
code as

onCountrySelected(value: string) {
reRenderSelect()
}


Here I am running reRenderSelect() function from a event handler for select
change,you can run it from anywhere in name.component.ts