plotting excel data in matlab [closed] - matlab

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.
Closed 9 years ago.
Okay, so i have compiled and done the calculations of a given data on excel spreedsheet. Now, because the data is so large, I want to use matlab to plot it. So, i separated each data set from 1-10 and saved them as txt files on a folder. I would like to use a code to assign some of the columns into column 1 and 2 and so on, say from set 2 for instance, and plot them. How should i approach it? I am currently using "importdata" code. How do i select the column i need in particular? Here is a sample of what i have so far:
set2=importdata(file2.txt)
column3=set2(?) (say i need column 3)
column4=set2(?) (say i need column 4)
plot(column3,column4)
I'm not good at matlab. I would like some help. Thanks
set2 data saved as file2
350 1.2 858 0.02 1300
550 1.4 721 0.02 1300
650 1.8 673 0.02 1300
750 2.2 600 0.01 1300

Note that you could just use MATLAB's built-in xlsread() function for reading data, rather than saving to text file and then loading. Extracting the columns would still be the same as the previous poster's answer.

Use
column2 = set2(:,2)
column3 = set2(:,3)
etc

Related

Am I using PCA in Orange in a correct way?

I am analysing if 15 books can be grouped according to 6 variables (of the 15 books, 2 are written by an author, 6 by an other one, and 7 by an other one). I counted the number of occurrences of the variables and I calculated the percentage. Then I used Orange software to use PCA. I uploaded the file. selected the columns and rows. And when it comes to PCA the program asks me if I want to normalize the data or not, but I am not sure about that because I have already calculated the percentage - is normalize different from calculating the percentage? Moreover, below the normalize button it asks me to show only:... and I have to choose a number between 0 and 100 but I don’t really know what it is.
Could you help me understand what I should do? Thank you in advance

how to calculate mean and variance in online learning [duplicate]

This question already has answers here:
Rolling variance algorithm
(13 answers)
Closed 7 years ago.
how to calculate mean and variance in online learning by matlab?
suppose we have a stream of data that each time we receive only 40 of data. i want to update mean and variance of this data set by get each 40 data.
I would like every time I get 40 data, I update mean and variance of the all data that received so far. please pay attention that I could not save all data and each time I can save only 40 data.
thanks a lot
You might want to calculate a running mean and a running variance. There is a very good tutorial here:
http://www.johndcook.com/blog/standard_deviation/
With these algorithms you don't need to keep all values in memory.

Extracting data from a very large dataset using matlab [duplicate]

This question already has an answer here:
Extracting unique data from large .txt files [closed]
(1 answer)
Closed 9 years ago.
http://tinypic.com/r/2dt5ge1/5
this is the link of screen shot of data which i want to extract.Data contains total 5,00,000 records/rows, what i want to do is, extract only those rows which has 19 at a particular position.
As you can see in the 9th and 19th row, after two 350 in the middle, there is 19. So i want to extract these rows only.Please help.
Also how many columns should i make while importing and in which format(text or numeric).
The data set is not really large, I would import everything and filter then. Using a numeric format, your data is <500MB which should be no Problem.
Start here: http://www.mathworks.de/de/help/matlab/import_export/import-numeric-data-from-a-text-file.html
To filter your data quick, use logical indexing e.g. data(data(:,4)==19,:) which would select every row where the 4-th column is 19.

single algorithm to convert octal to other number systems [closed]

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.
Closed 10 years ago.
I have come across a pretty neat algorithm to convert a decimal number to other number systems. program asks for two inputs: number to convert and the base. the output is the number in the base required.
I am wondering if there is possible a single algorithm to convert an octal number to the base of choice?
Of course it is possible. Any number in any base can be written in any other base. For example, it is pretty easy to convert base 8 to base 2, just go one by one from the back and write each number in base 2 using length 3 (this works because 8 = 2^3), e.g.
0o1234
1 > 001
2 > 010
3 > 011
4 > 100
0b001010011100
I bet the same algorithm you use to convert from base 10 to other bases can be easily modified to base 8.

Matlab: Is it possible to save in the workspace a vector that contains 4 millions of values?

I am calculating something and, as result I have a vector 4 millions elements. I am not still finished to calculate it. I´ve calculate it will take 2 and a half hours more. When I will have finished I could save it?
It is not possible, what can I do?
Thank you.
On Windows 32-bit you can have at maximum a double array of 155-200 millions of elements. Check other OSs on Mathworks support page.
Yes, just use the command save. If you just need it for later Matlab computations, then it is best to save it in .mat format.
save('SavedFile.mat','largeVector')
You can then load your file whenever you need it using the load function.
load('SavedFile.mat')
On my machine it takes 0.01 sec to get a random vector with 4 million elements, with whos you can see that it takes (only) 32 MB.
It would take only few seconds to save such amount of data with MATLAB. If you are working with post-R2007b then maybe it is better to save with '-v7.3' option, newer MATLAB versions use by default general HDF5 format but there could be some performance/disc usage issues.