objectivec Matlab矩阵说明 - 行向量(Column)#blog

Matlab矩阵说明 - 行向量(Column)#blog

Matlab - Column.m
% 以下為輸入指令
>> a=[1;2]
% 以下為輸出結果
a =
     1
     2

objectivec Matlab矩阵说明 - 列向量(Row)#blog

Matlab矩阵说明 - 列向量(Row)#blog

Matlab - Row.m
% 以下為輸入指令
>> a=[1 2]
% 以下為輸出結果
a =
     1     2

objectivec Matlab矩阵说明#blog

Matlab矩阵说明#blog

Matlab .m
% 以下為輸入指令
>> a = [1 2;3 4]
% 會看到以下輸出結果
a =
     1     2
     3     4

objectivec Matlab符号变数的二元函数依赖关系#blog

Matlab符号变数的二元函数依赖关系#blog

Matlab .m
% 以下為輸入指令
>> syms x y z(x,y)
% 這裡聲明 x, y 分別是一個符號變數,變數 z 依賴 x 和 y

objectivec Matlab符号变数依赖关系#blog

Matlab符号变数依赖关系#blog

Matlab .m
% 以下為輸入指令
>> syms x y(x)
% 這裡聲明 x 是一個符號變數,又聲明 y 是一個符號變數,且 y 的值由 x 決定

objectivec Matlabπ指令说明#blog

Matlabπ指令说明#blog

Matlab .m
% 以下為輸入指令
>> pi
% 以下為輸出結果
ans =
    3.1416

objectivec Matlab分行说明-2 #blog

Matlab分行说明-2 #blog

Matlab -2.m
% 以下為輸入指令
>> a=[1 2;...
3 4]
% 以下為輸出結果
a =
     1     2
     3     4

objectivec Matlab分行说明#blog

Matlab分行说明#blog

Matlab .m
% 以下為輸入指令
>> a = 100+...
200
% 這行代碼和 a=100+200 完全一樣;這種分行方式僅在輸入時有效,在實際運行中,Matlab 仍然認為這是一行代碼。
% 以下為輸出結果
a =
     300

objectivec Matlab注解说明#Blog

Matlab注解说明#Blog

Matlab .m
% 單行註解說明
>> y = sum(x)           % 代碼註解說明
%{
跳過此段代碼
%}

objectivec 测试互联网连接

.m
#import <Reachability.h>

@property (strong, nonatomic) Reachability *internetReachableFoo;

// Checks if we have an internet connection or not
- (void)testInternetConnection
{
    self.internetReachableFoo = [Reachability reachabilityWithHostname:@"www.bing.com"];
    
    // Internet is reachable
    @weakify(self);
    self.internetReachableFoo.reachableBlock = ^(Reachability*reach)
    {
        // Update the UI on the main thread
        dispatch_async(dispatch_get_main_queue(), ^{
            @strongify(self);
            [self loadRequest];
            NSLog(@"Yayyy, we have the interwebs!");
        });
    };
    
    // Internet is not reachable
    self.internetReachableFoo.unreachableBlock = ^(Reachability*reach)
    {
        // Update the UI on the main thread
        dispatch_async(dispatch_get_main_queue(), ^{
            NSLog(@"Someone broke the internet :(");
        });
    };
    
    [self.internetReachableFoo startNotifier];
}