Answered
removing rows containing certain values
Seth, You can create logical indexes with conditional statements, and use the *&* for "and" as well as *|* for "or" to combin...

8 years ago | 2

Answered
writing each line of a text file in a cell array
Hi Shima, From context clues, I'm guessing "myfile.txt" is a space-delimited table of data. Your approach is useful if you do...

8 years ago | 2

| accepted

Answered
How can I add XML attributes and corresponding values in line to RootNode
Hi Mateusz, You can add attributes directly to element nodes as well. I am providing code to create the < Attribute/ > node w...

8 years ago | 3

| accepted

Answered
how can I plot single x-value of type string against multiple y-values of type double?
You could visualize the data in many ways. Here's a simple way scatter the data and label each series. % using random data ...

8 years ago | 1

| accepted

Answered
if else, for loop, working with character variables
Two questions: 1. Is z.new initialized before you start assigning values to it? 2. Did you try curly braces? if z.LOA...

8 years ago | 0

| accepted

Answered
Import Excel data into Matrix, then search Matrix for specified text?
Samuel, You should probably take some time to read up on <http://www.mathworks.com/help/matlab/getting-started-with-matlab.ht...

8 years ago | 1

Answered
how can I sort an array of elements corresponding to another array of elements in decreasing order?
Try this out: % sort A in descending order (decreasing A values) % and keep the sort index in "sortIdx" [A,sortI...

8 years ago | 11

Answered
How to select the row of an element in a vector and put it in the same row for a different matrix?
Here's an example of creating an index and using it appropriately: A = [1;2;3]; B = NaN(3,5); % find where A is e...

8 years ago | 0

| accepted

Answered
is it possible to modify sudoku.m so that it counts how many times has called itself?
John, I'm not going to download the book or the sudoku.m file. Instead, here's an example called john_sudoku() with a recursi...

8 years ago | 1

| accepted

Answered
I need help importing this complicated data set into MATLAB.
Drew, I made a text file called DrewL.txt which literally has the faux-data you posted in your question. I am using the forma...

8 years ago | 0

Answered
Limits in hours in date vectors (datevec function)
This appears to be a bug in datestr() which *you can report to Mathworks support.* In Matlab 2015a, datestr line 166 has an i...

8 years ago | 1

| accepted

Answered
How do I create a matrix with the diagonals set to 10 and non-diagonals a random integer (0 to 2) where each row sums to 10 (without including diagonal)?
Here's a solution where you can change the values of matrix size, diagonal value, and non diagonal sum. Values between 0 and 2 a...

8 years ago | 1

| accepted

Answered
Set environment path using IP for directory
I believe this post discusses the format you're looking for. http://superuser.com/questions/267844/full-uri-to-a-file-on-anot...

8 years ago | 0

Answered
Generate all possible combinations of a few numbers when the internal order doesn’t matter and the length varies?
You're asking for the power set of your data. Careful not to use large arrays since the calculation will get out of hand rather ...

8 years ago | 0

| accepted

Answered
How can a plot from an "if" inside of a while loop?
Pre-allocate a large array to load values into during the loop. At the end of the loop, you can plot them all at once. I added t...

8 years ago | 1

| accepted

Answered
How can I combine multiple excel files in a single new excel file?
Is D a local disk or a remote network disk? This will go much faster if you save the files locally before trying to read them al...

8 years ago | 5

| accepted

Answered
Vectorization question (trying to avoid for loops)
I deleted the clear lines and switched the ( *t_max+1*) tendency to simply be *t_max*. I added *t_max* and *I* values up top so ...

8 years ago | 1

| accepted

Answered
convert cell array of different data type char and number to matrix
You have several options. 1) If every cell in your cell array contains a scalar double value, cell2mat() will work properly. ...

8 years ago | 0

Answered
How can I extract a certain 'cluster' of elements according to a particular condition on the elements?
Assuming you only want to find submatrices along the diagonal of C, the following code extracts all square submatrices (>rho) in...

8 years ago | 1

Answered
how to read .DOT file in matlab??
deep, Matlab doesn't have any built in functions to read and render .DOT images. You could do this outside of Matlab using to...

8 years ago | 1

Answered
How to evaluate a cell of function handles?
Max, If your function handles can accept an array of x values and return an array of results, then your current implementatio...

8 years ago | 3

| accepted

Answered
automating script using uiload
jakob, You can get the variables loaded in your workspace with the who command. Try out this example: m2 = magic(2); ...

8 years ago | 0

| accepted

Answered
How to code for generating a crossword out of some given random letters?
The code from the top 5 submissions is available by clicking the *Title* links here: http://www.mathworks.com/matlabcentral/c...

8 years ago | 0

| accepted

Answered
Plotting 3 matrix vs range curves
I don't know what the values of pcu or w are, but here's a simplification that works fine. t = 1e-9:1e-9:1000e-9; Rf = (...

8 years ago | 0

Answered
writing data to excel files
When writing to a row, specify your data as a row vector. When writing to a column, specify your data as a column vector. In ...

8 years ago | 0

| accepted

Answered
Read data from .dat file
You've given textscan directions to read 5 columns where the first two are %u (integers) and the next three are %f64 (doubles). ...

8 years ago | 1

| accepted

Answered
Plot title sprintf format pi
x is a double-precision floating point number. It will be displayed as a decimal by default. You can control how the double is r...

8 years ago | 1

| accepted

Answered
Creating Matrix using two vectors and scalar
jack, Please read the <http://www.mathworks.com/help/matlab/ref/repmat.html repmat() documentation> to understand its interfa...

8 years ago | 1

Answered
Combine datasets of unequal lengths by matching dates
niki, You can do all of this quite easily if you first put your data into <http://www.mathworks.com/help/matlab/tables.html t...

8 years ago | 3

| accepted

Answered
isequal functions is not working, what am I doing wrong?
In your Command Window, type this: format long A_T A_1 You'll see elements of A_T and A_1 are essentially the same...

8 years ago | 0

| accepted

Load more