回答済み
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...

12年以上 前 | 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...

12年以上 前 | 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

12年以上 前 | 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...

12年以上 前 | 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 ; ...

12年以上 前 | 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...

12年以上 前 | 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 ...

12年以上 前 | 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 ...

12年以上 前 | 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...

12年以上 前 | 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] ; ...

12年以上 前 | 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...

12年以上 前 | 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...

12年以上 前 | 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 ...

12年以上 前 | 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...

12年以上 前 | 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...

12年以上 前 | 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...

12年以上 前 | 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...

12年以上 前 | 1

| 採用済み

さらに読み込む