Beantwortet
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 ...

mehr als 12 Jahre vor | 2

Beantwortet
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 ...

mehr als 12 Jahre vor | 4

| akzeptiert

Beantwortet
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' ...

mehr als 12 Jahre vor | 1

| akzeptiert

Beantwortet
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...

mehr als 12 Jahre vor | 3

Beantwortet
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...

mehr als 12 Jahre vor | 1

| akzeptiert

Beantwortet
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...

mehr als 12 Jahre vor | 1

| akzeptiert

Beantwortet
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...

mehr als 12 Jahre vor | 1

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

mehr als 12 Jahre vor | 1

| akzeptiert

Beantwortet
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...

mehr als 12 Jahre vor | 4

| akzeptiert

Beantwortet
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[...

mehr als 12 Jahre vor | 2

| akzeptiert

Beantwortet
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 ...

mehr als 12 Jahre vor | 5

| akzeptiert

Beantwortet
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...

mehr als 12 Jahre vor | 1

Beantwortet
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...

mehr als 12 Jahre vor | 2

| akzeptiert

Beantwortet
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...

mehr als 12 Jahre vor | 1

| akzeptiert

Beantwortet
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...

mehr als 12 Jahre vor | 0

Beantwortet
I have a vector Y=[1, 1, 1, 2, 2, 2,2,2, 3, 3, 3,4]. How can I make matlab tell that the total number of values that are different from each other in the vector is 4? thank you very much
doc unique doc length and you'll find a simple solution using both functions

mehr als 12 Jahre vor | 3

| akzeptiert

Beantwortet
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...

mehr als 12 Jahre vor | 1

| akzeptiert

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

mehr als 12 Jahre vor | 1

| akzeptiert

Beantwortet
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...

mehr als 12 Jahre vor | 1

Beantwortet
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 ...

mehr als 12 Jahre vor | 1

Beantwortet
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 ...

mehr als 12 Jahre vor | 1

| akzeptiert

Beantwortet
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...

mehr als 12 Jahre vor | 1

| akzeptiert

Beantwortet
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] ; ...

fast 13 Jahre vor | 0

| akzeptiert

Beantwortet
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...

fast 13 Jahre vor | 0

| akzeptiert

Beantwortet
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...

fast 13 Jahre vor | 0

| akzeptiert

Beantwortet
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 ...

fast 13 Jahre vor | 1

Beantwortet
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...

fast 13 Jahre vor | 0

Beantwortet
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...

fast 13 Jahre vor | 0

| akzeptiert

Beantwortet
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...

fast 13 Jahre vor | 1

| akzeptiert

Beantwortet
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...

fast 13 Jahre vor | 1

| akzeptiert

Mehr laden