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

alrededor de 12 años hace | 2

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

más de 12 años hace | 4

| aceptada

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

más de 12 años hace | 1

| aceptada

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

más de 12 años hace | 3

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

más de 12 años hace | 1

| aceptada

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

más de 12 años hace | 1

| aceptada

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

más de 12 años hace | 1

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

más de 12 años hace | 1

| aceptada

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

más de 12 años hace | 4

| aceptada

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

más de 12 años hace | 2

| aceptada

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

más de 12 años hace | 5

| aceptada

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

más de 12 años hace | 1

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

más de 12 años hace | 2

| aceptada

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

más de 12 años hace | 1

| aceptada

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

más de 12 años hace | 0

Respondida
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

más de 12 años hace | 3

| aceptada

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

más de 12 años hace | 1

| aceptada

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

más de 12 años hace | 1

| aceptada

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

más de 12 años hace | 1

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

más de 12 años hace | 1

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

más de 12 años hace | 1

| aceptada

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

más de 12 años hace | 1

| aceptada

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

más de 12 años hace | 0

| aceptada

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

más de 12 años hace | 0

| aceptada

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

más de 12 años hace | 0

| aceptada

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

más de 12 años hace | 1

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

más de 12 años hace | 0

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

más de 12 años hace | 0

| aceptada

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

más de 12 años hace | 1

| aceptada

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

más de 12 años hace | 1

| aceptada

Cargar más