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

más de 12 años hace | 0

| aceptada

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

más de 12 años hace | 1

| aceptada

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

más de 12 años hace | 1

| aceptada

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

más de 12 años hace | 0

| aceptada

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

más de 12 años hace | 0

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

más de 12 años hace | 3

| aceptada

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

más de 12 años hace | 1

| aceptada

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

más de 12 años hace | 1

| aceptada

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

más de 12 años hace | 1

Respondida
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', ' ' )

más de 12 años hace | 1

| aceptada

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

más de 12 años hace | 0

| aceptada

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

más de 12 años hace | 0

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

más de 12 años hace | 0

| aceptada

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

más de 12 años hace | 0

| aceptada

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

más de 12 años hace | 1

| aceptada

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

más de 12 años hace | 2

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

más de 12 años hace | 1

| aceptada

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

más de 12 años hace | 1

| aceptada

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

más de 12 años hace | 0

| aceptada

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

más de 12 años hace | 1

| aceptada

Respondida
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

más de 12 años hace | 2

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

más de 12 años hace | 0

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

más de 12 años hace | 1

| aceptada

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

más de 12 años hace | 0

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

más de 12 años hace | 0

| aceptada

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

más de 12 años hace | 0

| aceptada

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

más de 12 años hace | 1

| aceptada

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

más de 12 años hace | 1

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

más de 12 años hace | 0

| aceptada

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

más de 12 años hace | 1

| aceptada

Cargar más