Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Import/Load data

Subject: Import/Load data

From: Joao Fontiela

Date: 4 Nov, 2012 22:40:10

Message: 1 of 2

I have the following data series with 4 variables:
X Y Z S
6 6
5.6 5.7
4.9 5 5.4
4.9 5 5.1
5.3 5.2 5.7
5.5 5.6 5.9
4.7 4.9 5.2
4.7 4.9 5.1
4.5 4.6 4.7
4.2 4.7 4.9
4.5 4.5 4.5
4.4 4.8 4.6
4.5 4.6 4.7
4.6 4.8 4.8
5.1 5.2 5.4 5.2
4.7 4.8 4.8
4.9 4.9 5.2 5.2
4.5 4.6 4.7
4.9 4.9 5.1 5.1
4.4 4.7 4.9
4.3 4.6 5
4.5 4.6 5
4.7 4.8 5.4
4.1 4.5 4.4
4.5 4.8 4.8
4.7 4.8 5.2 5
4.2 4.7 4.5
4.6 4.8 4.8
4.5 4.8 4.7
4.6 4.7 5
4.6 4.9 4.7
4.5 4.8 4.6
4.6 4.8 4.8
4.5 4.6 4.6
4.7 4.7 4.9
4.3 4.5 4.7
4 4.5 4.8
4.4 4.4 4.8
4.3 4.6 5
4.4 4.6 4.7
4.9 4.9 5.2 5
4.4 4.7 4.9
4.3 4.5 4.7
4.4 4.5 4.8
4.1 4.5 4.8
4.7 5.2 5.2 5.1
4.3 4.6 5 5
4.9 4.8 5.3 5.2
4.3 4.5 4.8
5.1 5.3 5 5
5.3 5.3 5.6 5.5
4.2 4.7 4.8
4.3 4.5 4.8
4.5 4.7 5.2
4.1 4.7 5
4.4 4.7 4.7
4.5 4.8 4.8
4.6 4.8 4.8
3.8 4.5 4.8
6 6.1 6.3
4.8 4.8 5
5.8 5.9 6.1
4.3 4.4 4.8
5 5.2 5.2
4.7 4.9 5
5.1 5.2 5.4
4.9 5 5.1
4.6 4.5 4.8
4.1 4.7 5
4.7 4.7 5
5.1 5.2 5.3
4.8 4.9 4.9
5 5.2 5.1
4.6 4.8 4.8
4.8 4.9 5
5.2 5.4 5.3
5.3 5.4 5.5
4.7 4.7 5
4.9 5
5 5.1
4.2 4.9 5.1
4.9 5.1
3.9 4.9
4 4.6 4.9
3.7 4.8
5 5.1
4.7 4.8
3.9 4.8
4 5
4.7 5.1
4.7 4.8



and I want import or load these data keeping the empty cells of each variable in order to analyze statistical relations between them.
When I use import option missing data are replaced by NaN :(.
I have used command dlmread but it joined data from variable S on Z :((

Subject: Import/Load data

From: Ryan

Date: 15 Nov, 2012 05:01:14

Message: 2 of 2

Hummmm, not sure what you're doing, exactly. I just imported your data; I got created this code:
%% Import data from spreadsheet
% Script for importing data from the following spreadsheet:
%
% Workbook: C:\Users\Excel\Desktop\NAN.xls Worksheet: Sheet1
%
% To extend the code to different selected data or a different spreadsheet,
% generate a function instead of a script.

% Auto-generated by MATLAB on 2012/11/14 23:55:17

%% Import the data
[~, ~, raw] = xlsread('C:\Users\Excel\Desktop\NAN.xls','Sheet1');
raw = raw(2:end,:);

%% Replace non-numeric cells with 0.0
R = cellfun(@(x) ~isnumeric(x) || isnan(x),raw); % Find non-numeric cells
raw(R) = {0.0}; % Replace non-numeric cells

%% Create output variable
untitled = cell2mat(raw);

%% Clear temporary variables
clearvars raw R;

Don't worry about the NAN thing; it simply means not-a-number:
http://www.mathworks.com/help/matlab/ref/nan.html



"Joao Fontiela" wrote in message <k76qsa$t81$1@newscl01ah.mathworks.com>...
> I have the following data series with 4 variables:
> X Y Z S
> 6 6
> 5.6 5.7
> 4.9 5 5.4
> 4.9 5 5.1
> 5.3 5.2 5.7
> 5.5 5.6 5.9
> 4.7 4.9 5.2
> 4.7 4.9 5.1
> 4.5 4.6 4.7
> 4.2 4.7 4.9
> 4.5 4.5 4.5
> 4.4 4.8 4.6
> 4.5 4.6 4.7
> 4.6 4.8 4.8
> 5.1 5.2 5.4 5.2
> 4.7 4.8 4.8
> 4.9 4.9 5.2 5.2
> 4.5 4.6 4.7
> 4.9 4.9 5.1 5.1
> 4.4 4.7 4.9
> 4.3 4.6 5
> 4.5 4.6 5
> 4.7 4.8 5.4
> 4.1 4.5 4.4
> 4.5 4.8 4.8
> 4.7 4.8 5.2 5
> 4.2 4.7 4.5
> 4.6 4.8 4.8
> 4.5 4.8 4.7
> 4.6 4.7 5
> 4.6 4.9 4.7
> 4.5 4.8 4.6
> 4.6 4.8 4.8
> 4.5 4.6 4.6
> 4.7 4.7 4.9
> 4.3 4.5 4.7
> 4 4.5 4.8
> 4.4 4.4 4.8
> 4.3 4.6 5
> 4.4 4.6 4.7
> 4.9 4.9 5.2 5
> 4.4 4.7 4.9
> 4.3 4.5 4.7
> 4.4 4.5 4.8
> 4.1 4.5 4.8
> 4.7 5.2 5.2 5.1
> 4.3 4.6 5 5
> 4.9 4.8 5.3 5.2
> 4.3 4.5 4.8
> 5.1 5.3 5 5
> 5.3 5.3 5.6 5.5
> 4.2 4.7 4.8
> 4.3 4.5 4.8
> 4.5 4.7 5.2
> 4.1 4.7 5
> 4.4 4.7 4.7
> 4.5 4.8 4.8
> 4.6 4.8 4.8
> 3.8 4.5 4.8
> 6 6.1 6.3
> 4.8 4.8 5
> 5.8 5.9 6.1
> 4.3 4.4 4.8
> 5 5.2 5.2
> 4.7 4.9 5
> 5.1 5.2 5.4
> 4.9 5 5.1
> 4.6 4.5 4.8
> 4.1 4.7 5
> 4.7 4.7 5
> 5.1 5.2 5.3
> 4.8 4.9 4.9
> 5 5.2 5.1
> 4.6 4.8 4.8
> 4.8 4.9 5
> 5.2 5.4 5.3
> 5.3 5.4 5.5
> 4.7 4.7 5
> 4.9 5
> 5 5.1
> 4.2 4.9 5.1
> 4.9 5.1
> 3.9 4.9
> 4 4.6 4.9
> 3.7 4.8
> 5 5.1
> 4.7 4.8
> 3.9 4.8
> 4 5
> 4.7 5.1
> 4.7 4.8
>
>
>
> and I want import or load these data keeping the empty cells of each variable in order to analyze statistical relations between them.
> When I use import option missing data are replaced by NaN :(.
> I have used command dlmread but it joined data from variable S on Z :((

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us