Answered
most frequent value in a 3D matrix other than 0
Here is an example.. >> A = randi(5,[3,4,2]) - 1 A(:,:,1) = 0 3 1 4 2 0 2 0 3 ...

12 years ago | 2

Answered
Is it possible to detect a specefic form of matrices from a big one?
*EDITED:* got rid of a side effect in the dash case (illustrated in the 4th picture below.. I didn't update it though) by using ...

12 years ago | 4

| accepted

Answered
In an excel sheet, how can I extract the rows which contain a specific string data called (T1L2). this variable happens only in the second column (conditions). Thanks
Here is an example: >> raw = {'T1L2', 4; 'T8L9', 5; 'T1L2', 6} raw = 'T1L2' [4] 'T8L9' [5] 'T1L2' ...

12 years ago | 1

| accepted

Answered
Which MATLAB operations/functions need speeding up?
*EDITs* * 11/20, 5:00PM EST - Added comment about OOP. * 11/20, 5:10PM EST - Added comment about TRY statements. * 11/21, 8...

12 years ago | 3

Answered
How, if possible, do I limit the number of times REGEXP searches for a specific pattern?
I'll answer assuming that my last comment under your question is correct. It is nice to implement complex regular expressions fo...

12 years ago | 1

| accepted

Answered
Importing text file data?
What part are you not able to make more versatile? If you know a priori the number of columns, you can make the following cha...

12 years ago | 1

| accepted

Answered
word count matrix problem
Here is an alternate and probably simpler solution (because it's a 1 line solution after you update the call to UNIQUE) for coun...

12 years ago | 1

Answered
Converting a .txt into a series of matrices
Here is one way to achieve this: fileLocator = 'Bip_LAMMPS_Pract.txt' ; content = fileread( fileLocator ) ; tokens =...

12 years ago | 1

| accepted

Answered
Convert an IP address to a Country Location
One way to do it is to use some online API for IP identification. Here is an example: save the following function into your work...

12 years ago | 4

| accepted

Answered
Modifying Text Data without changing the file format?
Here is a simple enough way to achieve this. content = fileread( 'srcFile.txt' ) ; block1 = regexp( content, '^.+?\*NODE[...

12 years ago | 2

| accepted

Answered
Question of a vlookup equivalent in matlab
Try this: >> id = ismember(A(:,1), B) id = 1 0 1 >> C = A(id,:) C = 1 2 3 4 ...

12 years ago | 5

| accepted

Answered
Reading in xls files from folder- saving data with identifier from filename
You can build a solution based on the following (not tested). D = dir( 'Z:\MyFiles\FileName\d*.xls' ) ; tabs = {'X...

12 years ago | 1

Answered
count rectangles on big matrices
*== Final answer in comments.* *== ANSWER Sun@10:10am* The only easy improvement that I could think of is to eliminate ele...

12 years ago | 2

| accepted

Answered
subsetting dates in a matrix
You already have serialized/numeric time stamps in you array, so just convert date boundaries to numeric, and compare numbers: a...

12 years ago | 1

| accepted

Answered
Why are loops the devil?
The archetype of situations where people say that it's awful to use nested loops is the following: we need to count the number o...

12 years ago | 0

Answered
create a function to...
It's not bad actually. The lines positive=positive negative-negative are useless, and you want to create vectors of sum...

12 years ago | 1

| accepted

Answered
Grouping continuous nonzero in a row vector
Here is one solution.. wrap = [0, A, 0] ; temp = diff( wrap ~= 0 ) ; blockStart = find( temp == 1 ) + 1 ; ...

12 years ago | 1

| accepted

Answered
embedding matlab figures (.fig files) automatically into a Word document
Mixing information from.. * <http://www.mathworks.com/matlabcentral/answers/104375-set-excel-cell-dimension> * <http://matla...

12 years ago | 1

Answered
Nested for loop help needed
Following up on comments.. We usually try to avoid explicit loops when we can implement a matrix/vector approach. The latter ...

12 years ago | 1

Answered
copying every nth line and duplicating it on it's following line
Here is an example where I display the output so you can see each step: >> a = [1 2 3 4 5 6 7 8 9 10 11 12] a = 1 ...

12 years ago | 1

| accepted

Answered
Finding mean of data between rows data based on information in column data
Doesn't my answer to <http://www.mathworks.com/matlabcentral/answers/90590-produce-bin-averaged-latitude-and-longitude-grids you...

12 years ago | 1

| accepted

Answered
apply text values to elements in a vector
If you are allowed to remap "not moving" to e.g. code 1, you can proceed as follows: actions = [5,5,5,4,4,4,6,6,6,NaN,5] ; ...

12 years ago | 0

| accepted

Answered
textscan, problem with the treatasempty when the is the signal minus (-)
Here is a proposal that I can refine when/if you attach a file to your question: content = fileread( 'myFile.tsv' ) ; cont...

12 years ago | 0

| accepted

Answered
How to make datenum more efficient for large arrays?
What is the purpose ultimately? Do you need an accurate time stamp which accounts for the date and time? If you were computing d...

12 years ago | 0

| accepted

Answered
How can I extract specific columns of a Matrix
Here is an example >> A = [1 0 0 0;0 0 0 0;0 1 0 0;0 0 0 0] A = 1 0 0 0 0 0 0 0 ...

12 years ago | 1

Answered
How can I use a txt file as input of a table?
It is not trivial because there is a header and the decimal delimiter is the comma. If you need a numeric time stamp (suited for...

12 years ago | 0

Answered
calculate the annual discharge over several years
*EDIT after you edited the question:* it seems that there are 4 columns and not 2, and the discharge is in column4. I am updatin...

12 years ago | 0

| accepted

Answered
MatLab Looping Script with varying rows
It is difficult to answer, because we don't know what you mean by database, or why you need recursivity (why a FOR loop is not e...

12 years ago | 1

| accepted

Answered
beginner question array loops with values lower than 1
We usually do this in a vector way, and not element by element. However, your first attempt is almost correct for a loop-based a...

12 years ago | 1

| accepted

Load more