Cựu Học Sinh Lê Quý Đôn - Long An

Cựu Học Sinh Lê Quý Đôn - Long An (http://www.lqdlongan.com/forum/index.php)
-   Toán học (http://www.lqdlongan.com/forum/forumdisplay.php?f=140)
-   -   MatLab 2009a: đôi điều cần trao đổi (http://www.lqdlongan.com/forum/showthread.php?t=9103)

Le.Giang 04-04-2010 02:58 PM

MatLab 2009a: đôi điều cần trao đổi
 
xin mấy sư huynh chỉ giáo dùm!

em muốn load dữ liệu Excel lên MatLab 2009a phải dùng lệnh gì vậy?

chỉ rõ nhé, vì em có đọc trên mạng và file help mà không hiểu gì hết trơn!:tounge_smile:

myhanh 04-04-2010 03:06 PM

Ðề: MatLab 2009a: đôi điều cần trao đổi
 
1) Export xls file to csv file, đặt tên file.txt
2) fid = fopen('file.txt');
3)fscanf để đọc gì thì đọc
4) fclose(fid); đóng file
Có thể dùng lệnh xlsread nhưng chưa thủ.

Mình chỉ dùng Matlab 2007.

myhanh 04-04-2010 03:07 PM

Ðề: MatLab 2009a: đôi điều cần trao đổi
 
nếu không biết các lệnh xlsread xlsinfo thì dùng lệnh help trong Matlab:
help xlsread
help xlsinfo


Le.Giang 04-04-2010 04:04 PM

Ðề: MatLab 2009a: đôi điều cần trao đổi
 
help xlsread
Trích:

function m = csvread(filename, r, c, rng)
%CSVREAD Read a comma separated value file.
% M = CSVREAD('FILENAME') reads a comma separated value formatted file
% FILENAME. The result is returned in M. The file can only contain
% numeric values.
%
% M = CSVREAD('FILENAME',R,C) reads data from the comma separated value
% formatted file starting at row R and column C. R and C are zero-
% based so that R=0 and C=0 specifies the first value in the file.
%
% M = CSVREAD('FILENAME',R,C,RNG) reads only the range specified
% by RNG = [R1 C1 R2 C2] where (R1,C1) is the upper-left corner of
% the data to be read and (R2,C2) is the lower-right corner. RNG
% can also be specified using spreadsheet notation as in RNG = 'A1..B7'.
%
% CSVREAD fills empty delimited fields with zero. Data files where
% the lines end with a comma will produce a result with an extra last
% column filled with zeros.
%
% See also CSVWRITE, DLMREAD, DLMWRITE, LOAD, FILEFORMATS, TEXTSCAN.

% Copyright 1984-2006 The MathWorks, Inc.
% $Revision: 5.17.4.2 $ $Date: 2006/11/11 22:44:06 $

% Validate input args
if nargin==0
error(nargchk(1,1,nargin,'struct'));
end

% Get Filename
if ~ischar(filename)
error('MATLAB:csvread:FileNameMustBeString', ...
'Filename must be a string.');
end

% Make sure file exists
if exist(filename,'file') ~= 2
error('MATLAB:csvread:FileNotFound',...
'File not found.');
end

%
% Call dlmread with a comma as the delimiter
%
if nargin < 2
r = 0;
end
if nargin < 3
c = 0;
end
if nargin < 4
m=dlmread(filename, ',', r, c);
else
m=dlmread(filename, ',', r, c, rng);
end

Le.Giang 04-04-2010 04:13 PM

Ðề: MatLab 2009a: đôi điều cần trao đổi
 
hi hi!

đọc dữ liệu được rùi!
Code:

m = csvread(uigetfile(('*.csv'),'Select the '), 0, 2, [0,2,3050,5])
Code:

http://www.mediafire.com/download.php?dmzlkyzfgyk

Le.Giang 04-04-2010 05:04 PM

Ðề: MatLab 2009a: đôi điều cần trao đổi
 
Code:

>> M = csvread(uigetfile(('*.csv'),'Select the '), 0, 2, [0,2,49,5])
>> d=1:50
>> plot(d,M)
>> xlabel('Day of [01..50]')
>> ylabel('Gia tri')
>> title('Bang so lieu EURUSD1440.csv')


hoang 04-04-2010 09:22 PM

Ðề: MatLab 2009a: đôi điều cần trao đổi
 
ôi Matlab, thoát em anh mừng ơi là mừng :))

Le.Giang 04-04-2010 10:47 PM

Ðề: MatLab 2009a: đôi điều cần trao đổi
 
Trích:

Nguyên văn bởi hoang (Post 68546)
ôi Matlab, thoát em anh mừng ơi là mừng :))

mày biết cái gì thì chỉ anh em coi!

thông kê trong matlab như thế nào?

hoang 04-04-2010 11:57 PM

Ðề: MatLab 2009a: đôi điều cần trao đổi
 
chài, t chỉ rành bên tính toán, mô phỏng điện tử thôi, đa phần sử dụng simulink, mấy cái vụ thống kê pó tay, :D, không giúp được ku òi:P, aidada cố lên:P

Le.Giang 05-04-2010 11:17 AM

Ðề: MatLab 2009a: đôi điều cần trao đổi
 
Trích:

Nguyên văn bởi hoang (Post 68549)
chài, t chỉ rành bên tính toán, mô phỏng điện tử thôi, đa phần sử dụng simulink, mấy cái vụ thống kê pó tay, :D, không giúp được ku òi:P, aidada cố lên:P

sử dụng simulink như thế nào?


Múi giờ GMT +7. Hiện tại là 04:35 AM.

Website sử dụng phần mềm vBulletin phiên bản 3.6.8
do Công ty TNHH Jelsoft giữ bản quyền từ 2000 - 2024.
Hội CHS Lê Quý Đôn-Long An giữ bản quyền nội dung của website này