Preallocate object array problem: Toolbox Path

2 ビュー (過去 30 日間)
Nycholas Maia
Nycholas Maia 2018 年 1 月 11 日
コメント済み: Nycholas Maia 2018 年 1 月 12 日
I would like to preallocate a array of 'track' object.
The problem is that: The 'track class' is inside my toolbox called 'mix'.
My toolbox path is: .../Documents/.../Mix Toolbox/+mix/@track/track.m
Here is the class:
classdef track < handle
%TRACK Define the audio track object
% The track object will store the signal and
% all metadata of the audio file
properties
name
signal
end
methods
function this = track(file)
%CONSTRUCTOR Construct an instance of this class
% Init the track object:
fprintf("Loading: %s \n", file.name);
% Get the track name:
this.name = file.name;
% Read audio file:
[this.signal, ~] = audioread(file.name);
end
end
end
I'm trying do this:
N = 1000;
array(1, N) = @mix.track;
And I got this error:
Nonscalar arrays of function handles are not allowed; use cell arrays instead.
How can I preallocate a N array of this object?

採用された回答

per isakson
per isakson 2018 年 1 月 12 日
Starter:
array(1,10) = mix.track(file);
  1 件のコメント
Nycholas Maia
Nycholas Maia 2018 年 1 月 12 日
Thank you!!!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeTracking and Motion Estimation についてさらに検索

製品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by