Réponse apportée
reading data after a string
Here is one way, assuming that the block of data is the last content that you have in the file. If not, I can update the answer....

plus de 12 ans il y a | 0

| A accepté

Réponse apportée
how to use nargin function to take variable input arguments and return sum of those arguments
Well, if you had a function function x = doSomething(a, b, c, d) ... end |nargin| would tell you how many input ar...

plus de 12 ans il y a | 1

| A accepté

Réponse apportée
problem in converting double Array into character?
Just "type cast" to char: >> numberplate = char(a) numberplate = 1132 In your code, you convert to strin...

plus de 12 ans il y a | 1

| A accepté

Réponse apportée
Daily values to monthly sums
Well, TGIF anyway! Assuming that |iFeb1| is irrelevant (if not, the solution can be updated). % - Vector of months start d...

plus de 12 ans il y a | 0

| A accepté

Réponse apportée
Changing names within a data
You can proceed as follows, assuming that classes are initially stored in file |classes.txt| and that you want to create file |c...

plus de 12 ans il y a | 0

Réponse apportée
read in only certain columns of big text file
I'd do it as follows, assuming that what you don't want to do is to have to build the _formatSpec_ by yourself. We read the firs...

plus de 12 ans il y a | 3

| A accepté

Réponse apportée
Import CSV file according to timestamp
You could do something like the following (not tested): function selection = getFilesYearMonth( folder, year, month ) f...

plus de 12 ans il y a | 1

| A accepté

Réponse apportée
Vectorization of 2 for loops in MATLAB
It is not trivial to "vectorize" this setup, as there are operations that require some look up table, and there is accumulation ...

plus de 12 ans il y a | 1

| A accepté

Réponse apportée
How to vectorise loop to improve performance
If I understand well, have a table of class code, and let's say x and y coordinates Class 'A' 'B' 'C' 'A' 'B' ...

plus de 12 ans il y a | 1

Réponse apportée
creating a .res with 2 variables side by side (2 columns)
If your |.res| file is a basic text file, you can proceed as follows dlmwrite( 'myFile.res', [X,Y], 'delimiter', ' ' )

plus de 12 ans il y a | 1

| A accepté

Réponse apportée
can we use 'and' condition in "for"
You can't, it is always for loopIndex = someArray ... end which is not condition-based. You can do it with WHILE ...

plus de 12 ans il y a | 0

| A accepté

Réponse apportée
How to read all lines in txt file satisfying some condition
The following is assuming that you have one pair number/string per line in the file. match = regexp( fileread('myFile.txt'),...

plus de 12 ans il y a | 0

Réponse apportée
How to organise data based on a large range of numbers?
You can build a look up table, use it to create a vector of season IDs which match column 8 of your data, and then use the latte...

plus de 12 ans il y a | 0

| A accepté

Réponse apportée
Produce bin averaged latitude and longitude grids
Assuming that longitudes are in the range |[0,360[| and latitudes in the range ]-90,90[, here is part of a solution that you cou...

plus de 12 ans il y a | 0

| A accepté

Réponse apportée
How do I print a cell array with vectors of different length to an ascii file
Here is an example, assuming that a white space as separator is fine for you and that you want to write these vectors in the fil...

plus de 12 ans il y a | 1

| A accepté

Réponse apportée
Search a text file for a particular string and then read all values in that line in which string is present into MATLAB
content = fileread( 'myFile.txt' ) ; tokens = regexp( content, 'v =\s*\[([^\]]+)', 'tokens' ) ; values = sscanf( tokens...

plus de 12 ans il y a | 2

Réponse apportée
Sort sequencial data from an array into separate arrays
You can proceed as follows to create blocks of consecutive numbers: A_num = [A{:}] ; bStart = [0, find(diff(A_num)>1), ...

plus de 12 ans il y a | 1

| A accepté

Réponse apportée
Replace values in matrix (text to value)
Here is a small example using the following content vehicle trip_time A B C C23432 1234556 NULL NULL NULL C23...

plus de 12 ans il y a | 1

| A accepté

Réponse apportée
If statement with OR operator to create error message for a function
if A~=8 && A~=12 && A~=16 error('..','...') ; end you could also use ISMEMBER: if ~ismember(A, [8, 12, 16]) ...

plus de 12 ans il y a | 0

| A accepté

Réponse apportée
How can I access element with same index from multiple cells
>> extract = @(C, k) cellfun(@(c)c(k), C) ; >> extract(a, 1) ans = 1 1 1 1 >> extract(a, 3) ans =...

plus de 12 ans il y a | 1

| A accepté

Réponse apportée
column wise reshaping of the 3rd dimension?
>> AA = reshape( permute(A, [3,2,1]), 1, [] ) AA = 1 100 1000 2 200 2000 3 300 3000 4 400 4000

plus de 12 ans il y a | 2

Réponse apportée
Why does Matlab not complete if the runtime for a computation is too long?
You should output all the information that you can, i.e. loop counters, branch of conditional statements, etc. If it's slowing d...

plus de 12 ans il y a | 0

Réponse apportée
Reading in a document full of code
*Simple answer below, and a more complete function in comment #3. Code is attached to the comment.* You can use a REGEXP to...

plus de 12 ans il y a | 1

| A accepté

Réponse apportée
how can concat cell array with array?
s = {1; 2; 3; 4} ; % Column cell array. f = [10 20 30 40] ; % Row numeric array. c = [s, num2cell(f.')] ;

plus de 12 ans il y a | 0

Réponse apportée
Question on reading datafile in matlab
Here is a start assuming that it is not for a homework (in the sense that a REGEXP-based approach would probably not be accepted...

plus de 12 ans il y a | 0

| A accepté

Réponse apportée
How to sort data once it is read into matlab
The first column of |data| is a cell array of strings, whereas columns 2 and 3 are numeric arrays. You cannot concatenate them w...

plus de 12 ans il y a | 0

| A accepté

Réponse apportée
Importing text files into variables with the same name
Your attempts are not bad; we usually avoid using EVAL when possible and we don't generate variable names dynamically (I've seen...

plus de 12 ans il y a | 1

| A accepté

Réponse apportée
How can I change multiple lines in a text file?
Just for fun, here is a one-liner for reading/replacing (that I write on 3 lines for sake of clarity): repl = regexprep( fil...

plus de 12 ans il y a | 1

Réponse apportée
From vertices to Equations of the Plane
Hint: you can start with the following and implement the few additional computations required (realizing that a 4th parameter mu...

plus de 12 ans il y a | 0

| A accepté

Réponse apportée
Problem with sparse matrix - HELP
[i,j,s] = find( H ) ; Note that most often, when building a sparse matrix with vectors of indices/values, it is relevant t...

plus de 12 ans il y a | 1

| A accepté

Charger plus