Hello,
I am writing a script wherein a new class 'polynomial' is defined. When I run the script, I get the following error:
Error: File: polynomial.m Line: 49 Column: 10
A class definition must be in an "@" directory.
Upon typing which('polynomial'), I get the following output:
/home/..../multipoly/@polynomial/polynomial.m
Clearly, polynomial.m is in a directory called @polynomial, but I'm still getting the error. I'm quite confused by this. I am running 64bit R2012a on Ubuntu 12.04.
Any help would be appreciated. Thanks.
Adi

댓글 수: 2

Walter Roberson
Walter Roberson 2013년 8월 11일
Is multipoly your routine? Or is it (for example) inside Simulink ?
Adi gahlawat
Adi gahlawat 2013년 8월 11일
It is my routine, I found the problem, kindly see me reply to Per Isakson below. Thanks for replying.

댓글을 달려면 로그인하십시오.

 채택된 답변

per isakson
per isakson 2013년 8월 11일
편집: per isakson 2013년 8월 11일

0 개 추천

I assume that
  • you created the folder "/home/..../multipoly/@polynomial"
  • you created the file "polynomial.m"
  • the keyword, "class" appears in the file "polynomial.m" (line 49)
Do you try to use old or the new Class-Definition Syntax; do you use the new keyword classdef?
Did you try
which('polynomial','-all')

댓글 수: 3

Adi gahlawat
Adi gahlawat 2013년 8월 11일
Hi Per,
the class definition and the folder name are all good. The problem was that on the path of the folder, there was another folder with '@' in its name that was throwing MATLAB off. I renamed the folder and now everything is fine. Thanks for replying.
Adi
Jeremy Rutman
Jeremy Rutman 2015년 6월 18일
편집: Jeremy Rutman 2015년 6월 18일
I had a similar problem . It turns out ANY folder with ANY ampersand in it ANYWHERE along the path will munge things up royally. I officially declare this a bug
>> sm = segmodel( 'PROFILE', '0.16', 'use_real_pose', false );
Error using segmodel
Error: File: segmodel.m Line: 1 Column: 10
A class definition must be in an "@" directory.
>> which('segmodel','-all')
/home/jeremy/jeremy.rutman@gmail.com/dev/clothes_parsing/@segmodel/segmodel.m
% segmodel constructor
>>
Guillaume
Guillaume 2015년 6월 18일
Well, giving syntactical meaning to filesystem paths was never a good idea in the first place, but I'm afraid Mathworks does not see it this way.
You can declare it a bug, but unless Mathworks completely overhaul their approach to paths, it's not going to change.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Search Path에 대해 자세히 알아보기

태그

질문:

2013년 8월 11일

댓글:

2015년 6월 18일

Community Treasure Hunt

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

Start Hunting!

Translated by