Answered
How do I get regexp to read specific values in a text file?
I assumed that you forgot the |Platform| field in the first line of your sample data and took the following instead: Platfor...

13 years ago | 2

Answered
Summing nonsequential elements in a matrix
|magic(50)| is a square, 50x50 matrix. What do you want to achieve? Is it summing elements [5 7 19 33 34 35 36 47 50] of row 1 o...

13 years ago | 0

| accepted

Answered
how to find overlapping intervals?
If boundaries are integer, a solution can built based on CUMSUM for building interval IDs and DIFF or UNIQUE for finding boundar...

13 years ago | 1

Answered
Changing property attributes in a value class
I don't think that this _"hide and reveal"_ approach is sound/wise. You can implement whatever logic in your methods so they wor...

13 years ago | 1

| accepted

Answered
matrix from arrays of different size
I don't understand where 0 NAN 1 0 2 1 3 2 4 3 is coming from, but why do you need to have results in a single array? If ...

13 years ago | 0

Answered
Is MATLAB is automatically concatenating data from a text file?
What are you trying to achieve, extract the numbers? The space in the pattern |' +'| won't match tabs actually, but |'\s+'| woul...

13 years ago | 0

| accepted

Answered
Incorporating Structure Fields into a Function as Inputs
I am not sure that I understand what you are trying to do .. so you have a class e.g. |Transline|, which contains a method |crea...

13 years ago | 1

| accepted

Answered
Quickest way to convert numeric array to a cell array of strings
Ok, to be honest, my issue at this point is that this approach is not that common, and I can't figure out whether you are an exp...

13 years ago | 0

Answered
How can I extract arrays from a structure?
There is no such thing as |vals(i).data|. If you wanted to save only the 7 relevant columns, you could update a little your c...

13 years ago | 0

Answered
regriding an irregular matrix
A general approach could be the following, assuming that you have this matrix |A| with datenums in the first row. [y, m] = d...

13 years ago | 0

Answered
CSV: Create New Headerline
Assuming that there is no comma but tabs ( |\t| ) as delimiters, I give you one way to do it: % - Read input file data conte...

13 years ago | 2

| accepted

Answered
Is there way to suppress the timer?
Just use a |;| at the end of the line with the |toc|: >> tic ; pause(1) ; t = toc ; Here there is no output for example, ...

13 years ago | 0

| accepted

Answered
Matrix: Find corresponding elements in a different column
Ok, I understand; do you need columns to be separate? If not, you could go for the following solution: assume the whole dataset ...

13 years ago | 1

| accepted

Answered
Applying regexpi to csv file
So it is true that your CSV has not comma as delimiter? The general approach is to use TEXTREAD, TEXTSCAN, FSCAN, etc when yo...

13 years ago | 0

| accepted

Answered
is there a more efficient way to omit certain characters from a string without using loops?
One way would be newsf = regexprep(sf, '([CREP1-4]|SQ)', '') ; but what does "etc" encompass?

13 years ago | 1

| accepted

Answered
Convert Cell to String
You could use something like: s = sprintf('%s\n', x{:})

13 years ago | 1

| accepted

Answered
Problem Importing Data from a CSV file
You can also use TEXTREAD, as follows: [t, p] = textread('myFile.csv', '%s %f', 'delimiter', ' ', 'headerlines', 1) ;

13 years ago | 0

Answered
Reading in a file name with a zero
You probably want to do something like this: for imgId = first : last fileLocator = fullfile(source, sprintf('IMG_%04d...

13 years ago | 1

Answered
want to calculate the sum of the numbers appear in an array that is mix of NaNs and numbers
It is not trivial actually. Look at the following and let me know if there is anything unclear. Also, I let you check that it ma...

13 years ago | 0

| accepted

Answered
how to call a specific variable in matrix inside loop process..??
Here is an answer based on what I understood, and a truncated version of |xdata| in which I removed the last row that contains a...

13 years ago | 0

| accepted

Answered
String Match for Plotting in Excel
If states had no space in their names, or if you had commas as delimiters in the CSV file, you could go for a variant of [s...

13 years ago | 0

| accepted

Answered
How to calculate conditional sum of a part of vector/array based on a 2nd one
The following is an example of "vector approach": dif = [true, diff(B)~=0] ; blockId = cumsum(dif) ; blockSt...

13 years ago | 2

Answered
Why is regexp including extra data?
*EDIT:* if all words that you want to extract *are known a priori*, Per gave you the answer. Your pattern is too generic; it ...

13 years ago | 1

Answered
What does each line do?
If we execute the following in our command window (you'll have random numbers different from mine, and I work with 10 of them in...

13 years ago | 1

Answered
Problem with Forward Euler function?
You should build a simple case study outside of this function. It seems that you want to build an array whose rows contain the e...

13 years ago | 1

| accepted

Answered
How to search the continuous values with maximal size in a vector ?
You can go for a solution around the following: boundary = find([true, abs(diff(a))~=1, true]) ; [blockSize, boundaryStart...

13 years ago | 2

| accepted

Answered
Please help me with a while loop problem
The first thing that is not correct is the condition in the WHILE statement; you want to repeat the loop while the amount is bel...

13 years ago | 1

| accepted

Answered
Static class call via string variable
Yes, you can proceed the same way as with dynamic field names: myObject = myClass() ; methodName = 'foo' ; x = myObj...

13 years ago | 1

Answered
How to convert an nXn matrix into n/numXn/num matrix containing the sum of elelments
There is no function, up to my knowledge, that does this automatically (as you can see <http://www.mathworks.com/matlabcentral/a...

13 years ago | 1

| accepted

Answered
Assign cell elements from a cell array to another cell array
Curly brackets mean "content of" (and generate a comma-separated list when you use them with a range); they don't perform block ...

13 years ago | 5

| accepted

Load more