matlab

MATLAB m-file help formatting

I could not find what formatting available to write help for your own MATLAB function. Very little information is available in official documentation. Do you know about any other formatting that can be visible with Help Browser (not with help function)? As it is for built-in functions. How to format headings (like Syntax, Description, ...

How do you include authorship and version info into your MATLAB functions

This question is related to my previous one: MATLAB m-file help formatting. What do you usually write to describe authorship of your own function? Do you put it at the end of the function body or right after the help text before any code? How do you include version information? Is it possible to automatically update version after funct...

how to show points on image in matlab?

i have some pixel points lets say p1(1,1) and p2(1,10).......and so on i want to display these points on image in any color. how to do this? ...

Ceiling to Nearest 50

I can round the elements of A to the nearest integers greater than or equal to A ceil(A) But what about if I want to round it to the nearest 50 greater than or equal to A? For example, given the following A array, A=[24, 35, 78, 101, 199]; A subroutine should return the following B=Subroutine(A)=[50, 50, 100, 150, 200]; ...

remove whitespace and add character in txt

Hello. I have a problem with Matlab code. What I want is that you delete all the blanks in a. Txt (example file below) and that one could add character ||||||||||||| to the end of each line. Example txt: *|V|0|0|0|t|0|1|1|4|11|T4|H01||||||| P|40|0.01|10|1|1|0|40|1|1|1||1|*||0|0|0|| *|A1|A1|A7|A16|F|F|F|F|F|F|F|||||||| *|cod. serv|area...

i want to find the location of a number in a matrix in matlab.

i have a matrix lets say x = 2 2 3 4 3 2 6 4 8 now i want to get the location of a number 4. like i want ans like this ans=(2,1) (3,2) as these are the locations for 4 in matrix. ...

How to input the name of the text file as a function's argument in Matlab?

Basically I export .dat files, with headers, from a software and then I use data in them in Matlab. I am making a general function in Matlab which could read the data from the .dat files I export from the software. Can you tell me the way I can input the name of the .dat file as function's argument? function [property_without_headers]=g...

How to solve this using MATLAB

You are given a vector of test scores called tests, and wish to normalize these scores by computing a new vector, normTests, which will contain the test scores on a linear scale from 0 to 100. A zero will still correspond to zero, and the highest test score will correspond to 100. For example, if the highest score in the original data wa...

How to make clear to user that the function's argument to be entered as string in Matlab?

I have the following function whose last argument is a name of the text file: function [property_without_headers]=gslib_file_to_matlab_var(nModel,nCell,gslib_file_name) % must enter the last argument, gslib_file_name, in single quotes as its treated as a string if nargin<3, % making third argument optional (code to be executed even whe...

resize images and save them in a new folder

hi I need to take sequence of images as input from a folder and after resizing them I should save them in an new folder using matlab ...

How is python more poweful programming language than Matlab for engineering projects?

I have started learning python now and shortly we'll be employing it by writing codes and scripts to better the already existing geo-statiscal modeling software package called SGeMS. As to what I know right now regarding the project, it'll involve using the sophisticated programming and visualization capabilities built into Python. I hav...

Matlab for Python programmers

I've used Matlab on and off before, but I need to develop a good understanding of it now, and the language I'm most familiar with is Python. Care to describe a Matlab language feature, idiom, best practice or philosophy as compared to Python? There's a terrific amount of buzz for and resources pertaining to going the opposite direction...

parse text with Matlab

I have a text file (output from an old program) that I'd like to clean. Here's an example of the file contents. *|V|0|0|0|t|0|1|1|4|11|T4|H01|||||||||||||||||||||| P|40|0.01|10|1|1|0|40|1|1|1||1|*||0|0|0|||||||||||||||| *|A1|A1|A7|A16|F|F|F|F|F|F|F||||||||||||||||||||||| *|||||kV|kV|kV|MW|MVAR|S|S|||||||||||||||||||||||| N|I|01|H0...

matlab: quick function that can produce NaN if x > 1

I am looking for a one-line function f = @(x) {something} that produces NaN if x >= 1, and either 0 or 1 if x < 1. Any suggestions? ...

With MATLAB calculate a number of sinusoids inside a for-loop and then plot them.

I do the following in MATLAB and it works well. However I need to calculate 20 sinusoids instead of 3 and then plot them all. x=sin(1*w*t)*(2/(pi*1)); y=sin(3*w*t)*(2/(pi*3)); z=sin(6*w*t)*(2/(pi*6)); plot(t,x,t,y,t,z) I figure it should be possible to make a for-loop and then plot but I'm not sure how that's done and need some help...

Implementing a Harris corner detector

I am implementing a Harris corner detector for educational purposes but I'm stuck at the harris response part. Basically, what I am doing, is: Compute image intensity gradients in x- and y-direction Blur output of (1) Compute Harris response over output of (2) Suppress non-maximas in output of (3) in a 3x3-neighborhood and threshold ou...

how to find the corresponding point in other row of an array in matlab?

i have an array lets say x = 1 2 2 5 8 7 now i want to get the corresponding values of a number in 2nd row. like i have number =2 and i want ans= 8 and 7 as 8 and 7 are the corresponding points for 2. ...

How to get result of DISP as return parameter into a variable?

Both functions disp and display do not have return parameters and display variable content into command window. I would like to get the result of function call (displayed string) into a variable instead of output into command window, something like this str = ToString( myStruct ); where input variable is a MATLAB struct! I am aware ...

Why is not equal represented by ~= in Matlab?

This one of the things that has always bothered me about Matlab. I understand why arrays start at 1 and not at 0 like in any other programming language, but why is != ~= in Matlab? ...

Tools to be used for Image processing

I'm Developing a CBIR (Content based Image Retrieval System) as part of my BE project. Which of the below mentioned tools will be better to be used for image processing?? 1-> Matlab 2-> Mathematica I'm planning to develop this system using java as a front end of the system. which of above systems will be better. Or should I go for som...