matlab

matlab syntax errors in single layer neural network

I have to implement a single layer neural network or perceptron.For this, I have 2 files data sets , one for the input and one for the output.I have to do this in matlab without using neural toolbox.The format of 2 files is given below. In: 0.832 64.643 0.818 78.843 1.776 45.049 0.597 88.302 1.412 63.458 Out: 0 0...

atomically creating a file lock in MATLAB (file mutex)

I am looking for a simple already implemented solution for atomically creating a file lock in MATLAB. Something like: file_lock('create', 'mylockfile'); %this will block until it creates the lock file. file_lock('remove', 'mylockfile'); %this will remove the lock file: This question has already been asked several times, with some propo...

Solving polynomial equation system possibly having infinite solutions?

I have to solve polynomial equation system which gives error as it has infinite solutions and i just require few solutions(any 2 or 3) so how can i get them? , Can i specify condition on solution like solutions whose values range between 1 to 10 so that i can get few value. Equations are actually long complicated but infinite solutions ...

Why do I get an "Undefined function or variable <variable name>" error in this MATLAB code?

load X_Q2.data load T_Q2.data x = X_Q2(:,1); y = X_Q2(:,2); learningrate = 0.2; max_iteration = 50; % initialize parameters count = length(x); weights = rand(1,3); % creates a 1-by-3 array with random weights globalerror = 0; iter = 0; while globalerror ~= 0 && iter <= max_iteration iter = iter + 1; globalerror = 0; for p = 1:cou...

computing running averages in MATLAB

Computing a running average of a simple 1-D data vector seems simple enough. Indeed, the MATLAB documentation for FILTER happily claims something like: You can use filter to find a running average without using a for loop. This example finds the running average of a 16-element vector, using a window size of 3: D = [1:0.2:4]'; ...

matlab programming

I have a data set file that has 3 columns in it. 0 0 1 1 0 0 0 1 0 I have the loaded the data file into the matlab and now I want to check for which column the output "1" is present. The name of the file is: out.data Like in the first case- the "1" is present in the column 3rd. How do I write it in matlab? ...

Matlab subplot title and axes labels

I have the following script to ultimately plot a 4 by 2 subplot: files = getAllFiles('preliminaries'); n = size(files); cases = cell(1, n); m = cell(1, n); for i = 1:1:n S = load(files{i}); cases{i} = retransmission_distribution(S); c = size(cases{i}); m{1,i} = cell(1, c(2)); %figure(i); str_size = size(fil...

How to make a log plot in matlab

Is it possible to make a plot in matlab that does not actually take the logs of the values? I'm plotting wide ranges of values and when I try to make a log plot of them, those below 1 become negative. I would just like it to plot the values on a log scale without taking their logs. ...

MATLAB: single layer neural network

For the implementation of single layer neural network, I have two data files. In: 0.832 64.643 0.818 78.843 Out: 0 0 1 0 0 1 The above is the format of 2 data files. The target output is "1 for a particular class that the corresponding input belongs to and "0 for the remaining 2 outputs. The problem is as follows: Your ...

Why does my array in MATLAB saturate at a value of 255?

This is my code: arr = zeros(fx-10,1); frm = frams(x).cdata; for k=1:fx-10 for i=1:10 for j=1:fy arr(k) = arr(k)+ abs(frm(k+i-1,j)-model(i,j)) end end end Why the array receive only up to 255 value? I try to define: arr = zeros(fx-10,1,'int64'); and the code failed: ??? Undefined functio...

How to read multiple files into a single cell array?

Hi, I have a large dataset split into 5 files (each has 15000 attributes, first file contains header (attribute names) and 9999 records, and the other 4 contain 10000 records). Using textscan, I have created 5 cell arrays which have to be merged and don't know whether this approach is appropriate or it would be better to directly read ...

Matlab write 1-bit bmp

Hello, How can I write a 1-bit bmp image in Matlab using imwrite or any other function. the default of imwrite for bmp is 8-bit. Thanks a lot :) ...

Compiling C code for 64-bit Matlab on Intel MAC

Hi all, I need compile a piece of C code to be called from matlab (mex compiling). I am doing that on an intel mac and, since I am using Matlab's R2010a (7.10.0.499), I'd like to compile the C code into a version for 64-bits. For whatever reason, just doing mex with the -arch=maci64 option did not seem to work... As a way around, I...

How to iterate over a column vector in Matlab?

I have a column vector list which I would like to iterate like this: for elm in list //do something with elm How? ...

How to plot a plane in Matlab or scipy/matplotlib

I feel like I should know this, but somehow I'm drawing a blank for the last 30 minutes... How would one go plotting a plane in matlab or scipy from a normal vector and a point? I keep wanting to use the symbolic math solver, but I don't have the license for it currently... :\ Sorry if this is really basic, my brain just isn't working ...

Finding and filtering elements in a MATLAB cell array

Hi, I have a list (cell array) of elements with structs like this: mystruct = struct('x', 'foo', 'y', 'bar', 's', struct('text', 'Pickabo')); mylist = {mystruct <more similar struct elements here>}; Now I would like to filter mylist for all structs from which s.text == 'Pickaboo' or some other predefines string. What is the best way ...

Is it possible to wrap the text of xticks in matplotlib in python?

Anyone know if it is possible to wrap the xtick labels in matplotlib? Right now I've got the following code (kind of messy -- been hacking at it for a while): def plotResults(request, question_id): responses = ResponseOption.objects.filter(question__id=question_id).order_by('order').annotate(response_num=Count('response')) counts = ...

colormap in matlab

For a colormap how do you accentuate the brightness of some of the dimmer features? ...

Numerical computing environment on cloud? [ Undergrad Project ]

Hello all. I am a computer science undergraduate currently in my final year. As my final year project, I am thinking of creating a matlab-like numerical computing environment as SAAS that supports matrix manipulations, plotting of functions and data, image processing operations etc. The project is going to be created in Java + Scala. S...

MATLAB GUIDE gui listbox intermittently disappears with seemingly obsolete error

I am building a straightforward MATLAB gui using GUIDE. I have a listbox of items. Most of the time, it works as expected, but sometimes (usually after I edit the figure with GUIDE) populating the listbox causes it to disappear, along with this message: Warning: single-selection listbox control requires a scalar Value Control will not b...