Answered
Iterative loop storing variables
Here is an example a = 100 ; % Initial value. a_last = Inf ; threshold = 5 ; while abs(a - a_last) >= t...

11 years ago | 2

Answered
function based of the first n elements of a matrix
Based on what I understand, i.e. that you don't really need to build the X_n arrays, but just the O_n results, I propose that yo...

11 years ago | 1

Answered
About NotDirectoryError (Caught "std::exception" Exception message is:)
In your calls to delete: |SN{mm}{1}| is the folder name. |aa(nn).name| is the file name. so why are appending e.g. |'ma...

11 years ago | 0

Answered
How do you remove rows that contain a duplicate value within the same column of a cell array?
I am answering as if you could have multiple consecutive rows with same values in column 4. % - Modified data set that tests...

11 years ago | 1

Answered
urlwrite with http authentication
I have been using the URLREAD/WRITE_AUTH provided <http://stackoverflow.com/questions/1317931/how-do-i-provide-a-username-passwo...

11 years ago | 0

Answered
Arrange Matrix - Same Values of a Row to one Column
It is unclear how you want to export the result, but here is how you can extract the data by system name: isMatch = strcmp...

11 years ago | 4

Answered
How do I continue a Diary?
Don't use DIARY but SAVE, and save the workspace (or specific variables) in a |.mat| file: doc save doc load Note that ...

11 years ago | 2

Question


Positive roots of trigonometric equation.
Dear all, What would be a sound and reliable way for finding the first _n_ positive roots of the following? a = 918 ; ...

11 years ago | 2 answers | 1

2

answers

Question


Status for forum members: who would use/care for it?
Dear all, &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;I am well aware that the TMW forum is not Skype or gChat, but, while trav...

11 years ago | 7 answers | 0

7

answers

Answered
Importdata does not import whole .txt file
Here is an alternate way based on regular expressions content = fileread( '140708_LO_03_140710112412.txt' ) ; pattern = ['...

11 years ago | 2

Answered
I want to extract data from a text file
Here is one way content = fileread( 'PIM3dtry.txt' ) ; tokens = regexp( content, 'Densities\s+(.*?)\s{4}', 'tokens' ) ; ...

11 years ago | 1

| accepted

Answered
Need algorithm to create the list
Hello Muhammad, Here is an example, with 3 elements |Origin| and |Destination|, and a 4 elements |Survey_Location|.. % - ...

11 years ago | 2

Answered
Matrix padding with logical index
Assuming that the first array is |A|, the logical array is |B|, and you want to build |C|: C = zeros( size( B )) ; C(find(...

11 years ago | 1

| accepted

Answered
Transpose a matrix within a matrix
Assuming that you obtain a |3x3| matrix from the _k_-th row of |data| with Ak = reshape( data(k,:), 3, 3 ) ; you can tran...

11 years ago | 3

| accepted

Answered
Loop with two varying conditions
The most straightforward approach is probably to build a vector of month IDs, and then to loop over months and update values. So...

11 years ago | 1

| accepted

Answered
Find a string in a text file and replace it by elements of a matrix
Instead of |mat2str(A)|, use the following Astr = sprintf( [repmat('%d ', 1, size(A, 2)), '\r\n'], A.' ) ; str = strrep( ...

11 years ago | 1

| accepted

Answered
How to apply conditional statements so as to select certain rows or columns on a given dataset.
Here is another approach content = fileread( 'myData.txt' ) ; nPlus = sum( content == '+' ) ; rRows = regexp( conten...

11 years ago | 1

| accepted

Answered
Sorting Cell Array Elements in Multiple Columns
Here is one way to do it B = cellfun( @length, A{1}(:,3) ) ; % Get length of el. of 3rd col of A{1}. B([A{1}{:,3}] == 0)...

11 years ago | 1

Answered
Appel des sous-programmes
Bonjour, Il faut créer des fonctions qui prennent en entrée les paramètres qui les concernent, et qui sortent la valeur des t...

11 years ago | 1

Answered
What is the fastest way to determine whether a string is a number?
The following should be quite fast (faster than STR2DOUBLE for example): flag = ~isempty( sscanf( x, '%f' )) ; *EDIT:* if...

11 years ago | 2

Answered
Can Matlab append figures to an existing PDF file?
I never tested, but there is this on the FEX: <http://www.mathworks.com/matlabcentral/fileexchange/31215-append-pdfs> that you c...

11 years ago | 1

| accepted

Answered
Finding an element of a cell in a cell array
A simple loop would do C = { [1 2 3], [2 2 3], [5 2 7 10 2 1], [12 10 22 0] ,[4 7 5] } ; for cId = 1 : numel( C ) ...

11 years ago | 1

| accepted

Answered
Determine how format was set for compact versus loose
On my R2013b, |'compact'| and |'loose'| are values of property |FormatSpacing|. >> get( 0, 'FormatSpacing' ) ans = ...

11 years ago | 4

| accepted

Answered
How to find the indices of non-zero elements in a matrix
If it is for storing only non-zero elements, MATLAB supports <http://www.mathworks.com/help/matlab/ref/sparse.html SPARSE> matri...

11 years ago | 6

Answered
How do I "navigate" in textscann function
You need to use <http://www.mathworks.com/help/matlab/ref/xlsread.html XLSREAD> instead of FOPEN/TEXTSCAN, because the content o...

11 years ago | 1

| accepted

Answered
Method to count number of observations by category
How about counts = accumarray( s(:,end), 1 ) ; In the first case, it gives counts = 1 3 6 In the...

11 years ago | 1

| accepted

Answered
Reshape a column vector containing several stocks returns into a matrix format
Here is one way to process your data. You'll have to understand and check that it is correct (at least, check a dozen numbers in...

11 years ago | 3

| accepted

Answered
How do I extract consecutive numbers from a matrix?
Here is a solution, but there are many ways to do it, some simpler than others: grouped = mat2cell( A, 1, diff( [0, find(dif...

11 years ago | 7

| accepted

Answered
How can i insert Cyclic prefix in an array?
>> tx = [d(:,end-Cp+1:end) d] ; >> size(tx) ans = 8 1088 and >> tx = [zeros(size(d,1), Cp) d] ;...

11 years ago | 2

| accepted

Answered
How to make a loop to find average of each month
Here is one solution if you need monthly means over all years |[mean(Jan73,Jan74,..); mean(Feb73,Feb74,..); ..]|: dir_monthl...

11 years ago | 3

Load more