답변 있음
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년 초과 전 | 2

답변 있음
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년 초과 전 | 4

| 수락됨

답변 있음
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년 초과 전 | 1

| 수락됨

답변 있음
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년 초과 전 | 3

답변 있음
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년 초과 전 | 1

| 수락됨

답변 있음
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년 초과 전 | 1

| 수락됨

답변 있음
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년 초과 전 | 1

답변 있음
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년 초과 전 | 1

| 수락됨

답변 있음
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년 초과 전 | 4

| 수락됨

답변 있음
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년 초과 전 | 2

| 수락됨

답변 있음
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년 초과 전 | 5

| 수락됨

답변 있음
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년 초과 전 | 1

답변 있음
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년 초과 전 | 2

| 수락됨

답변 있음
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...

거의 13년 전 | 1

| 수락됨

답변 있음
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...

거의 13년 전 | 0

답변 있음
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

거의 13년 전 | 3

| 수락됨

답변 있음
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...

거의 13년 전 | 1

| 수락됨

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

거의 13년 전 | 1

| 수락됨

답변 있음
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...

거의 13년 전 | 1

답변 있음
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 ...

거의 13년 전 | 1

답변 있음
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 ...

거의 13년 전 | 1

| 수락됨

답변 있음
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...

거의 13년 전 | 1

| 수락됨

답변 있음
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] ; ...

거의 13년 전 | 0

| 수락됨

답변 있음
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...

거의 13년 전 | 0

| 수락됨

답변 있음
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...

거의 13년 전 | 0

| 수락됨

답변 있음
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 ...

거의 13년 전 | 1

답변 있음
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...

거의 13년 전 | 0

답변 있음
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...

거의 13년 전 | 0

| 수락됨

답변 있음
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...

거의 13년 전 | 1

| 수락됨

답변 있음
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...

거의 13년 전 | 1

| 수락됨

더 보기