Answered
Summing numerical data of excel files in Matlab
Assuming file names to be coded as follows: |data_001.xlsx, data_002.xlsx, .., data_100.xlsx|, you could build a solution based ...

12 years ago | 0

| accepted

Answered
Time serie import from csv
I'd personally read data directly from the XLS file.. [num,txt] = xlsread( 'Nam_rain_2005-2011_6.xls' ) ; dates = ...

12 years ago | 0

| accepted

Answered
How to right-justify columns in txt file using fprintf
There shouldn't be a white space in the _formatSpec_ string between the |%| and the format specifier. Observe the difference on ...

12 years ago | 2

| accepted

Answered
Need some help with equation error, please.
As the error message says, you are using variable |ya| in function |MAE340_P1| on line 14: Hs = c10*exp((-F*ya(2)/R*T)); ...

12 years ago | 0

Answered
find same dates in two cell array
At this point I don't know how your dates are coded, but here is a simple illustration. Assume that dates are 28, 29, 30, and da...

12 years ago | 2

| accepted

Answered
Grouping imported data and exporting into a .txt file
Ok, the code that you provided in your comment is a good start. Here is a hint: define >> x = [9, 3, 6, 7, 1, 2] ; Then, ...

12 years ago | 0

| accepted

Answered
how to remove unique values.
Assuming that elements of |A| are integers greater or equal to 1, you could do something like: >> nonUniqueValues = find( ac...

12 years ago | 0

| accepted

Answered
[DISCONTINUED] MATLAB Answers Wish-list #2 (and bug reports)
I think that it would be better to have the forum adding automatically a target attribute target="_blank" to links prese...

12 years ago | 1

Answered
Read a textfile in MATLAB
Could you copy/paste e.g. 20 lines of a typical file? If these lines that you are looking for are spread in a bunch of other typ...

12 years ago | 2

| accepted

Answered
Extract data from URL Human Mortality Database
MATLAB doesn't support well authentication. If you have 2013a, you can try <http://www.mathworks.com/support/solutions/en/data/1...

12 years ago | 2

| accepted

Answered
How to eliminate texts from the data file?
If the first line |"This measurement contains x,y and time"| is not present (if you added it for us to understand), you can do s...

12 years ago | 5

| accepted

Answered
How to read a text or a .c file without comments into a cell array ?
What about a simple.. buffer = fileread( 'function.c' ) ; buffer = regexprep( buffer, '/\*.*?\*/', '' ) ; buffer = r...

12 years ago | 1

Answered
instruction version of colon operator (:)
The way I am managing this is to use RESHAPE, which doesn't realloc or build temp array(s) as far as I could see. So what you do...

12 years ago | 1

| accepted

Answered
how to get distict values from many text files (please help)
The following approach is based on regular expressions: files = {'data_01.txt', 'data_02.txt'} ; nFiles = numel(files) ; ...

12 years ago | 1

| accepted

Answered
Huge problem when I import data from Yahoo
You are right about the cause. Do you really need to have ticker codes used as field names? Why not using a more basic cell arra...

12 years ago | 1

| accepted

Answered
Textscan reading file and surrounding text with single quotes
>> fileContent = 'ABCD 8 10.2' ; % Fake content for the ex. >> columns = textscan(fileContent, '%s %d %f...

12 years ago | 1

| accepted

Answered
How to create a specific matrix from a regular matrix
Here is a one-liner. Assume >> A = randi(20, 3, 4) % Example. A = 19 16 2 16 6 8 ...

12 years ago | 1

Answered
Extracting certain data from very large text/numeric data
Based on your comment: one way to tackle that is to split the file according to section headers/footer, so you get blocks that y...

12 years ago | 0

Answered
append the content of a txt to the end of a txt....
You can read/write line by line with something like while ~feof(fid1) line = fgetl(fid1) ; fprintf(fid, '%s\r\n', ...

12 years ago | 3

| accepted

Answered
append data to the end of a txt file...works for 1 line...it doesnt work for two lines
fprintf(fid,'alength\r\n blength\r\n') ;

12 years ago | 0

| accepted

Answered
how do i vectorise given code?
You should provide a numeric example, e.g. with a 4x4 array |A|, and show us a few steps of what you want to achieve. In your qu...

12 years ago | 1

Answered
Six cities in matlab with Dijkstra's Algorithm
Just use the FEX submission by Joseph Kirk that I used in this answer: <http://www.mathworks.com/matlabcentral/answers/82034-how...

12 years ago | 0

Answered
Textscan and file paths work on my MacBook, but not on Windows 7
For building the full path, use FULLFILE. In FOPEN, specify the permission explicitly, so you don't have to count on compatibili...

12 years ago | 0

| accepted

Answered
Use Textscan or sscanf?
Assuming that lines starting with a |'*'| are some sort of block footers, here is one way to extract data blocks: fid = fop...

12 years ago | 0

| accepted

Answered
Creating a monthly average from a matrix
Just avgAllYears = mean(KoppenA_prate, 3) ; where |3| is the dimension along which the mean must be computed. With that y...

12 years ago | 1

| accepted

Answered
Extracting and formatting data from a txt like file
You can do something like: fid = fopen('myFile.hoc', 'r') ; content = textscan(fid, 'pt3dadd(%f,%f,%f,%f,%f)') ; fclose(...

12 years ago | 2

| accepted

Answered
whats the syntax of i++ in matlab
No, not even |i+=1|. We see proposals going in that direction in various which-lists, but nothing was implemented so far. What w...

12 years ago | 2

| accepted

Answered
The "Did you mean..." routine
*See EDIT 2 and 3 below for a better version of the initial answer.* Here is another idea, just for the fun of it: classN...

12 years ago | 2

Answered
Code to search for a word in a file taking too long to execute.
Have you tried using regular expressions? For counting occurrence in file |A| of words from file |B|, you would do something lik...

12 years ago | 0

Answered
How do I find the last occurrence of a match using regexp in MATLAB?
Is it what you want? If so, we can work a bit to improve it (in particular for allowing stars in the comment if relevant, which ...

12 years ago | 2

Load more