Answered

Save While-loop to vector

Make your variables into vectors, by indexing through them: index = 1; while Velocity2(index) >=-20 Velocity2(...

Save While-loop to vector

Make your variables into vectors, by indexing through them: index = 1; while Velocity2(index) >=-20 Velocity2(...

10 years ago | 2

Answered

Extract Information Between M-Files

It depends how the m-files are defined. If they are scripts (that is, they are not defined by the 'function' keyword at the top)...

Extract Information Between M-Files

It depends how the m-files are defined. If they are scripts (that is, they are not defined by the 'function' keyword at the top)...

10 years ago | 0

| accepted

Answered

Pixel Selection within a GUI

Easiest (although not particularly clean) way might be to use ginput(), and then round the return coordinates to select the pixe...

Pixel Selection within a GUI

Easiest (although not particularly clean) way might be to use ginput(), and then round the return coordinates to select the pixe...

10 years ago | 0

Answered

How can I clear a graph before drawing a new one?

To clear the existing plot first: cla(gca); ezplot(...); To draw a plot in a new window: figure(); ezplot(.......

How can I clear a graph before drawing a new one?

To clear the existing plot first: cla(gca); ezplot(...); To draw a plot in a new window: figure(); ezplot(.......

10 years ago | 0

Answered

compare two datasets of unequal length and create a textfile

To read in the text files: doc dlmread To compare which dates occur in both files: doc intersect (The second o...

compare two datasets of unequal length and create a textfile

To read in the text files: doc dlmread To compare which dates occur in both files: doc intersect (The second o...

10 years ago | 1

| accepted

Answered

Need help plotting 100 Strings onto grid (FOR loop not working)!

I would use a text() function rather than a textbox annotation, since the former is a lot lighter than the latter. You ca...

Need help plotting 100 Strings onto grid (FOR loop not working)!

I would use a text() function rather than a textbox annotation, since the former is a lot lighter than the latter. You ca...

10 years ago | 0

Answered

I can't make A<B, it gives me 'lt' error

Hmmm...I don't see any 'sym' variables here. What is the class() of J and P?

I can't make A<B, it gives me 'lt' error

Hmmm...I don't see any 'sym' variables here. What is the class() of J and P?

10 years ago | 0

Answered

i have written this code i want to solve this heat equation for n vary from 0 to n(any value) for each value of x at each case from t= 0 to 10

Do you want to evaluate this numerically? Such that you have a value for T at each x and t. If so, your approach of using symsu...

i have written this code i want to solve this heat equation for n vary from 0 to n(any value) for each value of x at each case from t= 0 to 10

Do you want to evaluate this numerically? Such that you have a value for T at each x and t. If so, your approach of using symsu...

10 years ago | 0

Answered

Adding points onto a 3D figure in a GUI

Turn 'hold on', and then call plot3() to plot the points.

Adding points onto a 3D figure in a GUI

Turn 'hold on', and then call plot3() to plot the points.

10 years ago | 0

Answered

how can I read eeg signal manually ?

A quick Google search indicated this: <http://sccn.ucsd.edu/eeglab/> Apparently, this eeglab toolbox allows for import/manip...

how can I read eeg signal manually ?

A quick Google search indicated this: <http://sccn.ucsd.edu/eeglab/> Apparently, this eeglab toolbox allows for import/manip...

10 years ago | 0

Answered

How can I create a plot of a 3D mesh given node coordinates and element connectivity from an input file?

Hi Kirsten, First of all, can you clarify exactly what you are trying to plot? For the element connectivity you can define it...

How can I create a plot of a 3D mesh given node coordinates and element connectivity from an input file?

Hi Kirsten, First of all, can you clarify exactly what you are trying to plot? For the element connectivity you can define it...

10 years ago | 0

Answered

Identify and Obtain information from data files

To read the numeric values, I would use textscan() with the 'CommentStyle' option, such as: str = fileread('/your/file/name...

Identify and Obtain information from data files

To read the numeric values, I would use textscan() with the 'CommentStyle' option, such as: str = fileread('/your/file/name...

10 years ago | 1

Answered

finding the string from the text file

To get you started, look at the documentation for the following functions: doc strfind %to find whether a string is pres...

finding the string from the text file

To get you started, look at the documentation for the following functions: doc strfind %to find whether a string is pres...

10 years ago | 1

Answered

Saving a figure with multiple graphs

saveas() takes a figure handle. The output of a plot() command is a line handle (or a 2x1 vector of line handles, as you have it...

Saving a figure with multiple graphs

saveas() takes a figure handle. The output of a plot() command is a line handle (or a 2x1 vector of line handles, as you have it...

10 years ago | 0

Answered

To change Current Folder to the folder of .m File

cd(which(fileparts('/path/to/your/file.m')))

To change Current Folder to the folder of .m File

cd(which(fileparts('/path/to/your/file.m')))

10 years ago | 0

Answered

Trying to make loop that stops when xnew is closer to xlast by .001

If you could format your code using the 'Code' button above, that would help us read it. That said, I think the problem is in y...

Trying to make loop that stops when xnew is closer to xlast by .001

If you could format your code using the 'Code' button above, that would help us read it. That said, I think the problem is in y...

10 years ago | 0

Answered

Calculating (optimizing?) center of a sphere from surface points?

Here's one function that was developed to do this: <http://www.mathworks.com/matlabcentral/fileexchange/34129-sphere-fit-leas...

Calculating (optimizing?) center of a sphere from surface points?

Here's one function that was developed to do this: <http://www.mathworks.com/matlabcentral/fileexchange/34129-sphere-fit-leas...

10 years ago | 0

| accepted

Answered

Adding up words in matrices on Matlab

Another approach might be to use ismember(). For example: dictionary = {'hello', 'my', 'name', 'is', 'kevin', 'susan'}; %w...

Adding up words in matrices on Matlab

Another approach might be to use ismember(). For example: dictionary = {'hello', 'my', 'name', 'is', 'kevin', 'susan'}; %w...

10 years ago | 0

Answered

Will someone help me with a script I am writing to create a video from multiple pictures

The major issue that I see if that you are calling image() with a size, rather than the actual data (rgb). Try this: vidO...

Will someone help me with a script I am writing to create a video from multiple pictures

The major issue that I see if that you are calling image() with a size, rather than the actual data (rgb). Try this: vidO...

10 years ago | 0

| accepted

Answered

convert an array of numbers into letters; 1 =a, 2 =b, 3 = c etc.

Alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' numbers = [3,6,12,1,1,3] letters = Alphabet(numbers) Or using the ASCII...

convert an array of numbers into letters; 1 =a, 2 =b, 3 = c etc.

Alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' numbers = [3,6,12,1,1,3] letters = Alphabet(numbers) Or using the ASCII...

10 years ago | 4

| accepted

Answered

how can i read or open a .img file using Matlab?

I've never used it, but a quick search of the Help gave: doc hdrread

how can i read or open a .img file using Matlab?

I've never used it, but a quick search of the Help gave: doc hdrread

10 years ago | 0

Answered

How to inverse all vectors in a struct

Structure= structfun(@fliplr, Structure, 'UniformOutput', false)

How to inverse all vectors in a struct

Structure= structfun(@fliplr, Structure, 'UniformOutput', false)

10 years ago | 1

Answered

Split a matrix into a sum of other matrices

How is your matrix currently defined? Are you really combining both numeric elements (e.g. doubles) and symbolic elements (creat...

Split a matrix into a sum of other matrices

How is your matrix currently defined? Are you really combining both numeric elements (e.g. doubles) and symbolic elements (creat...

10 years ago | 0

Answered

Matlab newbie - what is wrong with this function?

When you select multiple files, the output in Filename is a cell array, not a string, so it won't work in strcat the way you exp...

Matlab newbie - what is wrong with this function?

When you select multiple files, the output in Filename is a cell array, not a string, so it won't work in strcat the way you exp...

10 years ago | 1

| accepted

Answered

Writing a function that returns the 5 coordinates to draw a square?

The nice thing about Matlab is that, for simple equations, the correct syntax looks almost identical to how you would write the ...

Writing a function that returns the 5 coordinates to draw a square?

The nice thing about Matlab is that, for simple equations, the correct syntax looks almost identical to how you would write the ...

10 years ago | 0

Answered

Plot 3d, z = f(x,y)

If you have the Curve Fitting Toolbox, doc sfit doc sftool

Plot 3d, z = f(x,y)

If you have the Curve Fitting Toolbox, doc sfit doc sftool

10 years ago | 0

Answered

Beginner Question -- IF loop (code at beginning of post)

For the input issue, use the option 's' to convert the input to string at the prompt, and then use str2double() to convert it to...

Beginner Question -- IF loop (code at beginning of post)

For the input issue, use the option 's' to convert the input to string at the prompt, and then use str2double() to convert it to...

10 years ago | 1

| accepted

Answered

unique rows of matrix

You can easily perform the task using: A = unique( B(:,[1 3]), 'rows'); But of course, this forms the intermediate mat...

unique rows of matrix

You can easily perform the task using: A = unique( B(:,[1 3]), 'rows'); But of course, this forms the intermediate mat...

10 years ago | 0

| accepted

Answered

Can anybody help me with what this kind of thing means In MatLab

Each of the idx_rX... variables are the output of find, and are indicating the indices of where the expression inside the parent...

Can anybody help me with what this kind of thing means In MatLab

Each of the idx_rX... variables are the output of find, and are indicating the indices of where the expression inside the parent...

10 years ago | 0

Answered

Getting mouse coordinates with x and y attached to them and displaying them in excel.

Convert x and y to cell arrays with the desired leading text ('x' or 'y'): xs = [ repmat('x', size(x)), num2str(x)]; ys ...

Getting mouse coordinates with x and y attached to them and displaying them in excel.

Convert x and y to cell arrays with the desired leading text ('x' or 'y'): xs = [ repmat('x', size(x)), num2str(x)]; ys ...

10 years ago | 0

| accepted