matlab

How to modify properties of a Matlab Object

I 've created a Matlab Class, something like that : classdef myclass properties x_array = []; end methods function increment(obj,value) obj.x_array = [obj.x_array ; value); end end end The problem is, the property "x_array" is never modified when i invoke the increment() function: ex: s = myclass i...

MATLAB class array

What would be the best way to manage large number of instances of the same class in MATLAB? Using the naive way produces absymal results: classdef Request properties num=7; end methods function f=foo(this) f = this.num + 4; end end end >> a=[]; >> tic,for i=1:1000 a=[a Request];en...

Find class probabilities in matlab PNN and make ROC plot

I have a Probablistic Neural Network classification experiment set up in matlab. I can get the classes for unseen data using the sim command. Is there any way i can get the probabilities for the classes that the classifier calculates. Also is there any direct way to plot the Reciever Operating Characterstic curve and calculate the Area U...

Handling large amount of structures in MATLAB

I need to handle massive (tens of millions) of MATLAB structs; I needed a dozen or so fields so I reckoned memory won't be an issue, until I discovered this ( explanation ) >> s=[]; >> s.first=1; >> whos Name Size Bytes Class Attributes s 1x1 132 struct >> s.second=2; >> wh...

Matlab multiplication of 2 vectors error

Hi, i have a small function with 2 vectors alpha = 1 1 1 1 1 1 1 1 1 f_uv = 193 193 194 192 193 193 190 189 191 and i get the error message: "??? Error using ==> mtimes Integers can only be combined with integers of the same class, or scalar doubles." when i try to do this: alphaf_uv = alp...

Is there an easy way to provide a Matlab-based Web App or Web Service?

A colleague and I have spent a few years developing a really cool Matlab application, MDLcompress. Within Matlab, I can type "MDLcompress('filename.txt')" and it will tell me all sorts of really cool stuff about the contents of filename.txt. We'd like to allow other people to use MDLcompress without downloading the code, installing Mat...

Differences between matlab and comsol script?

I find a lot of use for matlab, but my current employer don't have a matlab license: there is one for Comsol, which comes with comsol Script. On a first glance, comsol script is identical to matlab, but after awhile you find eerie differences. Many graphics graphics' features are not there, and you can't export figures to a vector graphi...

MATLAB "C" DLL Errors

I'm compiling some MATLAB functions into a C DLL. The exported mlf functions return a boolean value representing whether the function succeeded or not. When the return value is false, I want to find out the error information. I couldn't find a way to do that! (other than compiling and exporting the lasterror() function). Is there a C in...

Software engineering and patterns in Matlab GUI application?

I've been asked to develop a simple GUI application using Matlab and GUIDE, which will interact with a separate backend engine (also Matlab). I'm coming from a Java and .Net background. The Matlab documentation is strong on how to technically do this, but says little about the "engineering" process, in particular: How to package/names...

Detect a file in transit?

I'm writing an application that monitors a directory for new input files by polling the directory every few seconds. New files may often be several megabytes, and so take some time to fully arrive in the input directory (eg: on copy from a remote share). Is there a simple way to detect whether a file is currently in the process of being...

How to automate Matlab/Simulink/Real-TimeWorkshop code generation?

I want to use a Simulink mdl to generate C files in an automated fashion. I am currently trying to use an m-script and a dos command shell, but I am having issues with a "do you want to save" dialog hanging the m-script. By experimentation I know that the mdl is being modified when the "set_param" line is run (i.e. no "save" dialog iss...

Increasing efficiency of loop that uses datenum function?

The following loop takes about 700 seconds to run in octave and 22 seconds to run in matlab when the DJI matrix has 21000 rows. How can I increase the efficiency of this? for i=1:length(DJI) DJI2(i,1)=datenum(char(DJI(i,2)),'yyyy-mm-dd'); end ...

running code with threads in Octave

I have several blocks of the following code that each use there own matrix. Is there a way to run each block in it's own thread rather then run all of them sequentially? for i=1:length(DJI) DJI2(:,1) = reshape(datenum(strvcat(DJI(:,2)(:)), length(DJI(:,2)),'yyyy-mm-dd')); DJI2(:,2:6) = reshape(str2num(strvcat(DJI(:,3:7)(:)), length(DJI...

Using Matlab, how can I find the value K in the following root locus?

In Matlab, how can I find value of K, in a system that has oscillation? (system's tf, if needed: (K * (s + 25))/(s^3 + 24 s^2 + 100 s) ) PS. I'm using root locus. ...

Why does com.mysql.jdbc.Driver take forever to open in MATLAB?

I'm having an issue with com.mysql.jdbc.Driver in MATLAB and I'm hoping someone else has run into it and can help me out. Basically, my problem is that on one machine, every time I call database('mysql.jdbc.Driver', ...), that call takes approximately 30 seconds. I would just chalk this up as normal except that when I run the same scri...

Why is caching answers taking LONGER in MATLAB?

I have a long running function in MATLAB that I tried to speed up by adding caching and wound up slowing down my performance significantly. My code is basically searching for continuous "horizontal" lines in an edge detected image and the original code looks something like this: function lineLength = getLineLength(img, startRow, startC...

MATLAB: Using ODE solvers?

This is a really basic question but this is the first time I've used MATLAB and I'm stuck. I need to simulate a simple series RC network using 3 different numerical integration techniques. I think I understand how to use the ode solvers, but I have no idea how to enter the differential equation of the system. Do I need to do it via an m-...

Is there any way to silence the 'hold' function in Matlab

I'm doing some data analysis in Matlab, and anytime I call the hold function to keep plotting to the current figure, I get an output like this: Current plot held I'd like to avoid this print, since it's just ugly and clutters my output. Unfortunately, placing a ; after the command does not silence it. Is there something I can do (sav...

linprog slow for my problem

Hi I am working on a matlab application for which I need much improved speed. I am using linprog to solve a 2-constraint linear program with around 10,000 variables bounded by zero and one. Linprog is extremely slow for my application. Is there any way I can reformulate to improve speed? Or do you perhaps know of some matlab-compati...

Looking for Matlab to F#/C# Script Convertor

I have a bunch of <5 matlab scripts. Is there a tool that can spit out F# or c# equivalent from them. ...