Show only the first x lines of csv/excel file in Talend - talend

I have a csv file which I convert, via a tmap to filter some things, to an excel file and I want to show only the first 16 lines of it.
Where can I set this?

In the input component property, set limit as 16.

You can use a "tsamplerow" for that after the csv input with the code "1..16"

Related

MATLAB: datasets stuck in each box

I'm unsure how to phrase exactly my problem. I have run a script and it is putting each file of data into one box, making four files, a 1x4 array. I can click on each and t will expand, however this is not the format that is acceptable. Is it possible to extract this to turn it into one single file? I attached a picture.
Your second file has 23 columns instead of 24, so you cannot just add them together. If you add a column to the second file you can convert them using:
b=cell2mat(a')
adding a column can be done like this:
a{2}(:,24)=nan;

matlab lose response when use xlsread reading a large spreadsheet

I am trying to use xlsread functioin to read spreadsheets of 6000x2700 (xlsx file).
I have two questions:
First, when I use something like
[num,txt,~]=xlsread(input_file,input_sheet,'A1:CYY6596')
Matlab keeps showing 'busy' and lose response (while I can open it in excel within 30 seconds).
Is there any solution If I don't want to loop through ranges of the xlsx file? In other word, can I just dump spreadsheet of this size into matlab using xlsread?
Alternatively, Maybe I can use loops to read these files range by range, but I cannot identify the last column of each of the spreadsheets unless I read the whole file first. Therefore, If I cannot identify the last column, it is hard to make loops and do my interpretation on the file.
So My second questions is: Is there a way to identify the last column of the spreadsheet without reading the whole spreadsheet?
Thanks.
EDIT:However, if I run a similar code which only reads first 400 columns ('A1:RY6596') of the spreadsheet, such problem doesn't happen.
which version of matlab you are using?
matlab has a problem to load bix excell file.
convert the excell in csv and use M = csvread(filename).
You can try to convert .xlsx into .xls also.
You can Try the tool in
File Exchange

In Matlab read a specific column of data in a text file

I have a text file that, when opened in excel, contains columns of data.
I want to use textread in matlab to read a specific column of data.
So, if it were an excel file, I could do:
Data = 'My_data_file.xlsx';
Column_C = xlsread(Data,'C:C');
But how do I do this with a text file?
Thanks!
You will need to know the format of your file. If you have a file that looks like this :
Name,Price,Volume
Sally,120,4.8
John,135,35.49324
You could use the following code :
[~,~,C]=textread('file.txt',%s,%f,%f);
You will insert a ~ to suppress output of certain columns.
Not tested, but you can go through--
help textread;
help csvwrite;
Once you get csv from txt, by
[num, txt, all] = xlsread('My_data_file.csv');
you can get everything inall.
How to get the column, you know well.

Load txt-file with two different delimiters into struct

I'm having trouble with loading .txt file in Matlab. The main problem is having not equal rows. I'll attach the file so you can more clearly see what I'm truing to say. First, the file has information about each node in graph. One row has information like this:
1|1|EL_1_BaDfG|4,41|5,1|6,99|8,76|9,27|13,88|14,19|15,91|19,4|21,48...
it means:
id|type|name|connected_to, weight|connected_to, weight| and so on..
I was trying to use fscanf function, but it only reads whole line as one string. How I suppose to divide it into struct with information that I need?
Best regards,
Dejan
Here, you can see file that I'm trying to load
An alternative to Stewie answer is to use:
fgetl to read each line
Then use
strread (or textscan) to split the string
Firstly using the | delimiter - then on the sub section(s) containing , do it a second time.

In Matlab, how do I create a CSV file from a subset of the lines in a text file?

I need to open a text file and convert it into a CSV file in Matlab. The first 3 lines of the text file are sentences that need to be omitted. The next 28 lines are numbers that need to make up the first column of the CSV, and then the next 28 lines need to make up the second column.
The text file is called datanal.txt and the output file can be named anything. Any help would be appreciated.
Don't have Matlab now to test, but try this. Your input file should be in Matlab's current directory, or put the full path to the file name.
A = csvread('datanal.txt',3,0);
A = reshape(A,28,2);
csvwrite('output.csv',A)
well you can add #'s in front of the first 3 lines then use load and a reshape. Did you need a fully automated script or is there only one file? If you're familiar with matlab at all there are a bunch of ways to turn that large column vector into a matrix.