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;
Related
I want from a csv archive to read only one column. The problem is that I want to read this column from the second line and by using these commands:
[d1,tex]= xlsread(filename1);
name=tex(:,4)
it's reading from the first line.
Also, I would like to create a matrix that will inclue two columns that have come from commants (equations etc) in my Matlab code.
xlsread is deprecated by MathWorks. Try using readtable in the future.
To your original question, I'm assuming that you want to read everything in the 4th column from the second row onward. If so, your second line is incorrect:
name = tex(2:end,4)
Without further example code, I can't answer the rest of your question. Add some details and I'll see what I can do.
I use GUIDE to create a uitable and load data into it, which looks like:
My question is: How to display the numbers without using scientific notation?
I have tried this but failed:
format long g
set(handles.uitable1,'Data',data)
Furthermore, since I will do some calculation of the number and save it to an excel file, I wish it could remain as a numeric array, not changing it to string.
Go to the table in your .fig file, right click on the table and select "Table Property Editor".
At the column definitions, you will see a column named "Format".
Choose custom from the dropdown as shown below:
Now choose how you want the output to be.
I want to convert a spreadsheet (e.g. .xls or from LibreOffice Calc) to some text format, e.g. .csv, without evaluating formulas so the formulas are stored in the text file. I know that LibreOffice has an option "Save cell formula instead of calculated values" when saving as .csv and according to How to export spreadsheet to CSV without evaluating formulas Excel can do this too, but I'd like to do it on command line. I know that ssconvert from the Gnumeric package can convert on command line but as fa as I ca see there's no option to keep the formulas.
The bigger picture is that I want to write a script that takes two versions of an .ods file, converts them and shows the differences. When only one cell has really changed but many other cells depend on it, then I want to see only the real change.
I have used xls2csv under Cygwin. Just a Google search shows many implementations. I would start there.
http://search.cpan.org/~ken/xls2csv-1.07/script/xls2csv
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.
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.