You are on page 1of 13

>> z(2,1:3)

ans =

>> z(2,:)

ans =

>> z(1:4,4)

ans =

4 8 12 16

>> z(2:3,4)

ans =

8 12

>> z(1:4,4)

ans =

4 8 12 16

>> z(2,4)

ans =

>> x=zeros {2,3} ??? Undefined variable "zeros" or class "zeros".

>> x=zeros {2,3}; ??? Undefined variable "zeros" or class "zeros".

>> zeros {2,3}

??? Error using ==> zeros Trailing string input must be a valid numeric class name.

>> zeros{2,3} ??? Undefined variable "zeros" or class "zeros".

>> j=ones(3,2)

j=

1 1 1

1 1 1

>> x=zeros (2,3)

x=

0 0

0 0

0 0

>> k=eye(3,4)

k=

1 0 0

0 1 0

0 0 1

0 0 0

>> k=eye(3,3)

k=

1 0 0

0 1 0

0 0 1

>> sum(z)

ans =

28 32 36 40

>> mean(z)

ans =

9 10

>> z=[1:4;5:8;9:12;13:16]

z=

1 5

2 6

3 7

4 8

9 10 11 12 13 14 15 16

>> sum(z)

ans =

28 32 36 40

>> mean(z)

ans =

9 10

>> z(2,4)

ans =

>> z(2:3,4)

ans =

8 12

>> z(2:4,4)

ans =

8 12 16

>> z(1:4,4)

ans =

4 8 12 16

>> z(2:3,4)

ans =

8 12

>> z(1:4,4)

ans =

4 8 12 16

>> z(2:4,4)

ans =

8 12 16

>> z(1,:)

ans =

>> z(2,:)

ans =

>> z(2,1:3)

ans =

>> z(2,1:3)

ans =

>> z(2,:)

ans =

>> z(1:4,4)

ans =

4 8 12 16

x=[1 2], y =[4 5], z= [0 0]

x=

y=

z=

>> A=[x y]

A=

>> B=[x; y]

B=

1 4

2 5

>> A=[x y z]

A=

>> B=[x; y; z]

B=

1 4 0

2 5 0

>>

>> x=zeros {2,3} ??? Undefined variable "zeros" or class "zeros".

>> x=zeros {2,3}; ??? Undefined variable "zeros" or class "zeros".

<?php class Upload extends Controller { function Upload() { parent::Controller(); // $this->load->helper('form'); } function index() {

$this->load->view('upload_form'); } function doUpload() { $config['upload_path'] = 'uploads/'; $config['allowed_types'] = 'gif|jpg|jpeg|png'; $config['max_size'] = '1000'; $config['max_width'] = '1920'; $config['max_height'] = '1280'; $this->load->library('upload', $config); if(!$this->upload->do_upload()) echo $this->upload>display_errors(); else { $fInfo = $this->upload->data(); $this->_createThumbnail($fInfo['file_name']); $data['uploadInfo'] = $fInfo; $data['thumbnail_name'] = $fInfo['raw_name'] . '_thumb' . $fInfo['file_ext']; $this->load->view('upload_success', $data); } } function _createThumbnail($fileName) { $config['image_library'] = 'gd2'; $config['source_image'] = 'uploads/' . $fileName; $config['create_thumb'] = TRUE; $config['maintain_ratio'] = TRUE; $config['width'] = 75; $config['height'] = 75; $this->load->library('image_lib', $config); if(!$this->image_lib->resize()) echo $this->image_lib>display_errors(); } }

Final View
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html> <head> <title>Upload an Image </title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> </head> <body> <div id="container"> <h2>Upload an Image </h2> <?php echo form_open_multipart('upload/doUpload'); ?> <input type="file" name="userfile" />

<p><input type="submit" value="Submit" name="submit" /></p> <?php echo form_close(); ?> </div> </body> </html>

I hope you guys enjoyed this video tutorial. If youd like to see more CodeIgniter tutorials and videos on Nettuts+, please be loud in the comments. I know Id like to see more! Im in the process of learning this framework myself, so links to resources, tips, etc. will be much appreciated!

Follow us on Twitter, or subscribe to the NETTUTS RSS Feed for more daily web development tuts and articles.

You might also like