https://es.mathworks.com/matlabcentral/answers/questions.atomMATLAB Answers — New Questions2017-06-22T16:24:41Ztag:es.mathworks.com,2005:Question/3458642017-06-22T15:15:36Z2017-06-22T16:24:41Zhow to solve a ode problem with a multistep method<p>hi, im trying to solve an ode problem by using a multistep method ( i must do it this way). 'Assignment has more non-singleton rhs dimensions than non-singleton subscripts' thats the quote matlab gave me by running the code. I think its a really simple problem, but im not very skillful at programming.
Thanks =)</p>Daniel Ortizhttps://es.mathworks.com/matlabcentral/profile/authors/9095532-daniel-ortiztag:es.mathworks.com,2005:Question/3458752017-06-22T16:22:17Z2017-06-22T16:22:17Zcreate and name .txt file with fopen<p>Hello, I have the following piece of code:</p><pre> num_lights = 3;
light_direction = [1, 2, 3; 4, 5, 6; 7, 8, 9];</pre><pre> fileID = fopen('test_name.txt','w');
fprintf(fileID, '%i \n', num_lights);
fprintf(fileID, '%f %f %f \n', light_direction);
fclose(fileID);</pre><p>The problem is, I don't want a fixed name for my file.
It should look somewhat like this:</p><pre> fileID = fopen('test_name', xyz, '.txt','w');</pre><p>xyz would be a %s.tring that is defined earlier.
What is my mistake. The documentation for fopen doesn't seem to include more complex names.
And I don't want to use a rename function since this wouldn't be proper programming (I was told...)</p><p>Thanks for your help! J</p>Jonas Khttps://es.mathworks.com/matlabcentral/profile/authors/7693918-jonas-ktag:es.mathworks.com,2005:Question/3452682017-06-19T05:21:54Z2017-06-22T16:22:06ZHow can I use single float with filtfilt in matlab coder?<p>I use matlab coder (matlab version:R2017a) to compile matlab code to C code .And I want to use single floating-point number.While I have used filtfilt function in matlab code. Then I got an error it said filtfilt only takes double floating-point number.I have tried using single() to convert parameters in filtfilt but still failed.Is there anyone can help me?Thanks.</p>WillandSmithhttps://es.mathworks.com/matlabcentral/profile/authors/6764352-willandsmithtag:es.mathworks.com,2005:Question/3458342017-06-22T13:21:57Z2017-06-22T16:21:33ZWhy Can't I build a C++ file using mex?<p>I have a C++ file that I want to use with my matlab code. The file compiles using mex successfully when I use</p><pre class="language-matlab">mex -c Miguel_2D_unwrapper.cpp
</pre><p>But fails when I use</p><pre class="language-matlab">mex Miguel_2D_unwrapper.cpp
</pre><p>I get the following error:</p><pre class="language-matlab">Error using mex
Cannot export mexFunction: symbol not defined
collect2.exe: error: ld returned 1 exit status
</pre><p>I am sure the problem is not with the code. I am using MinGW and matlab 2017a</p>Hamza Mahdihttps://es.mathworks.com/matlabcentral/profile/authors/6990791-hamza-mahditag:es.mathworks.com,2005:Question/3108472016-11-06T06:30:32Z2017-06-22T16:16:07ZMatlab R2010a supported compiler Visual C++ 2010 is not showing even after downloading.<p>I need to install matlab supported compiler and I downloaded a zip file for the compatible compiler and run the following command in the matlab command window: unzip('D:\Z-Astha\Study\HRS\Tool\VS2010MEXSupport.zip', matlabroot);
mex-setup
But no compiler is shown.
Please advise.</p>Astha Ametahttps://es.mathworks.com/matlabcentral/profile/authors/7536719-astha-ametatag:es.mathworks.com,2005:Question/3444022017-06-12T15:12:01Z2017-06-22T16:12:15ZProblem with data uitable <p>Hello everyone!
I would like to ask a question about a program using a GUI in which when clicking on a pushbotom a table with the following characteristics is created:</p><p>Columns: Building 1, Building 2 ... (depending on the number of buildings you need)
Rows: Fixed will have the height of each building, the height property, and the number of walls (each building can have the walls that are needed)</p><p>It is a program that designs a scenario for which I have a pushbotom to draw it (here there is no problem).</p><p>When I press the pushbotton to create the table with the properties of buildings, I see the table filled with zeros with the number of rows and columns corresponding, where I can edit in every building all possible walls.</p><p>An example: If I have two buildings, I get the table with two columns, one for each building. Regarding the rows, if for example building 1 has 4 walls, and building 2 has 6 walls, the number of rows in the table will correspond to the building with the largest number of walls (building 2) and two rows Which will always have all the buildings as I mentioned above corresponding to the height and property.</p><p>For building 1 then we will have 2 (height and property) + 4 (walls), 6 editable rows and 2 non-editable rows.
For building 2 then we will have 2 (height and property) + 6 (walls), 8 editable rows and 0 not editable.</p><p>The problem comes when once I have edited the table, I put another building and push the pushbotton again where I get the perfect table with the number of rows and columns editable, and all these are back to 0 and I would like to be Keep the values I had when I first edit the properties table, but with the option to be able to edit them in case the second time I want to change some value.</p>Lorenzo Villafrancahttps://es.mathworks.com/matlabcentral/profile/authors/8504478-lorenzo-villafrancatag:es.mathworks.com,2005:Question/3458742017-06-22T16:10:45Z2017-06-22T16:11:47ZROS Device Connection Test error<p>Hi
I am trying to run a standalone simulink node on my beaglebone with ubuntu and ros but i cant establish connection. I can establish connection with beaglebone with ssh from terminal with that user and password.</p><p>Any idea?
Thanks for reading</p><img src = "/matlabcentral/answers/uploaded_files/81180/dudamatlab.png"><img src = "/matlabcentral/answers/uploaded_files/81181/duda.png">Daniel Ramírezhttps://es.mathworks.com/matlabcentral/profile/authors/8342393-daniel-ramireztag:es.mathworks.com,2005:Question/3452612017-06-19T03:10:48Z2017-06-22T16:09:19ZHow can I plot the energy spectral density of a linear chirp using chirp function?<p>t = 0:1/1e3:2;
y = chirp(t,0,1,250);</p><p>This is the code I used for linear chirp.</p>Jan Valenciahttps://es.mathworks.com/matlabcentral/profile/authors/8043282-jan-valenciatag:es.mathworks.com,2005:Question/3458712017-06-22T15:56:57Z2017-06-22T16:06:16ZHow can I set a variable alpha channel to an image?<p>I display the mean of a 2-D distribution with imagesc(mean(whatever)), and I wish to make it transparent where the distribution std reach a maximum and opaque where std is at its minimum.</p><p>Alpha channel allows me to make the whole image more or less transparent, how can I apply a variable alpha channel?</p>emandhttps://es.mathworks.com/matlabcentral/profile/authors/8359474-emandtag:es.mathworks.com,2005:Question/3458732017-06-22T16:06:13Z2017-06-22T16:06:13Z"From Workspace" data buffering into frames<p>Hello,
I am trying to put together into frames (in simulink) some input I am reading from an .xlsx file.
Then those frames want to further process them in a MATLAB function block I have introduced in my design.
So far I've tried to use a buffer and frame conversion blocks,the former requires discrete sampling,the latter simply does not put the data into frames (automatically) of course.
In my attempt to convert the sampling rate from continuous to discrete I have used the rate transition block
which shows noOp as type of filter (that in my understanding means that doesn't do much) and consequently when connected to the buffer and error is returned:"All sample times must be discrete. No continuous or constant sample times are allowed.".</p><p>Could you please advise me on how to put the data I get from workspace into frames (and maybe not contentious time as it is now)?</p>Georgioshttps://es.mathworks.com/matlabcentral/profile/authors/5961356-georgiostag:es.mathworks.com,2005:Question/3457782017-06-22T06:24:11Z2017-06-22T16:06:10Zi am creating a gui .first image is uploaded but when i am going to process button it is direct to previous step . the process button dose not work .what can i do?<pre class="language-matlab">function varargout = ui(varargin)
% UI MATLAB code for ui.fig
% UI, by itself, creates a new UI or raises the existing
% singleton*.
%
% H = UI returns the handle to a new UI or the handle to
% the existing singleton*.
%
% UI('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in UI.M with the given input arguments.
%
% UI('Property','Value',...) creates a new UI or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before ui_OpeningFcn gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to ui_OpeningFcn via varargin.
%
% *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one
% instance to run (singleton)".
%
% See also: GUIDE, GUIDATA, GUIHANDLES
</pre><pre class="language-matlab">% Edit the above text to modify the response to help ui
</pre><pre class="language-matlab">% Last Modified by GUIDE v2.5 20-Jun-2017 16:16:26
</pre><pre class="language-matlab">% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @ui_OpeningFcn, ...
'gui_OutputFcn', @ui_OutputFcn, ...
'gui_LayoutFcn', [] , ...
'gui_Callback', []);
if nargin && ischar(varargin{1})
gui_State.gui_Callback = str2func(varargin{1});
end
</pre><pre class="language-matlab">if nargout
[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
</pre><pre> gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT</pre><pre class="language-matlab">% --- Executes just before ui is made visible.
function ui_OpeningFcn(hObject, eventdata, handles, varargin)
handles.output = hObject;
guidata(hObject, handles);
</pre><pre class="language-matlab">% UIWAIT makes ui wait for user response (see UIRESUME)
% uiwait(handles.figure1);
</pre><pre class="language-matlab">% --- Outputs from this function are returned to the command line.
function varargout = ui_OutputFcn(hObject, eventdata, handles)
% varargout cell array for returning output args (see VARARGOUT);
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
</pre><pre class="language-matlab">% Get default command line output from handles structure
varargout{1} = handles.output;
</pre><pre class="language-matlab">figure1.text = 'upload image'
% --- Executes on button press in pushbutton2.
function pushbutton2_Callback(hObject, eventdata, handles)
[filename, pathname] = uigetfile({'*.bmp';'*.jpg';'*.gif';'*.*'}, 'Pick an Image File');
S = imread([pathname,filename]);
axes(handles.axes1);
imshow(S);
handles.f=[pathname,filename];
guidata(hObject, handles);
figure1.text = 'image uploaded'
</pre><pre class="language-matlab">% --- Executes during object creation, after setting all properties.
function axes1_CreateFcn(hObject, eventdata, handles)
% hObject handle to axes1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
</pre><pre class="language-matlab">% Hint: place code in OpeningFcn to populate axes1
</pre><pre class="language-matlab">% --- Executes on button press in pushbutton3.
function pushbutton3_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton3 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
</pre><pre class="language-matlab">%[filename,pathname] = uigetfile({'*.*';'*.bmp'; '*.jpg'; '*.gif'; '*.tiff'}, 'Pick an Image File');
%s = strcat(pathname, filename);
a = uigetfile();
filename = a;
setappdata(0,'filename',filename);
</pre><pre class="language-matlab">if filename == -1
error('Failed to open file.')
msgbox('Failed to open file.');
end
</pre><pre class="language-matlab">a = imread(a);
% if isequal(filename,0) || isequal(pathname,0)
% disp('User pressed cancel')
% else
% disp(['User selected ', fullfile(pathname, filename)])
</pre><pre> % end</pre><pre class="language-matlab">axes(handles.axesimg);
imshow(a);
setappdata(0,'a',a);
setappdata(0,'filename',a);
assignin('base','a',a);
plot(handles.axesimg,'a')
%handles.f = [filename];
%guidata(object_handle,handles);
disp('Reading the image into variable X');
[X,map] = imread(filename);
assignin('base','X',X);
assignin('base','map',map);
</pre><pre class="language-matlab">assignin('base','width',200);
assignin('base','height',200);
</pre><pre class="language-matlab">edittimes.Visible = 'off';
</pre><pre class="language-matlab">function process_Callback(hObject, eventdata, handles)
% hObject handle to process (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
I= getappdata(0,'a');
%a_binary_image=improcess(a,[140 160 260 280]);
%Small region is taken to show output clear
binary_image = binary_image(120:400,20:250);
figure;imshow(binary_image);title('binary_image');
</pre><pre class="language-matlab">%Thinning
thin_image=~bwmorph(binary_image,'thin',Inf);
figure;imshow(thin_image);title('Thinned Image');
</pre><pre class="language-matlab">%Minutiae extraction
s=size(thin_image);
N=3;
n=(N-1)/2;
r=s(1)+2*n;
c=s(2)+2*n;
double temp(r,c);
temp=zeros(r,c);bifurcation=zeros(r,c);ridge=zeros(r,c);
temp((n+1):(end-n),(n+1):(end-n))=thin_image(:,:);
outImg=zeros(r,c,3);
outImg(:,:,1) = temp .* 255;
outImg(:,:,2) = temp .* 255;
outImg(:,:,3) = temp .* 255;
for x=(n+1+10):(s(1)+n-10)
for y=(n+1+10):(s(2)+n-10)
e=1;
for k=x-n:x+n
f=1;
for l=y-n:y+n
mat(e,f)=temp(k,l);
f=f+1;
end
e=e+1;
end;
if(mat(2,2)==0)
ridge(x,y)=sum(sum(~mat));
bifurcation(x,y)=sum(sum(~mat));
end
end;
end;
</pre><pre class="language-matlab">[ridge_x ridge_y]=find(ridge==2);
len=length(ridge_x);
</pre><pre class="language-matlab">for i=1:len
outImg((ridge_x(i)-3):(ridge_x(i)+3),(ridge_y(i)-3),2:3)=0;
outImg((ridge_x(i)-3):(ridge_x(i)+3),(ridge_y(i)+3),2:3)=0;
outImg((ridge_x(i)-3),(ridge_y(i)-3):(ridge_y(i)+3),2:3)=0;
outImg((ridge_x(i)+3),(ridge_y(i)-3):(ridge_y(i)+3),2:3)=0;
</pre><pre> outImg((ridge_x(i)-3):(ridge_x(i)+3),(ridge_y(i)-3),1)=255;
outImg((ridge_x(i)-3):(ridge_x(i)+3),(ridge_y(i)+3),1)=255;
outImg((ridge_x(i)-3),(ridge_y(i)-3):(ridge_y(i)+3),1)=255;
outImg((ridge_x(i)+3),(ridge_y(i)-3):(ridge_y(i)+3),1)=255;
end</pre><pre class="language-matlab">[bifurcation_x bifurcation_y]=find(bifurcation==4);
len=length(bifurcation_x);
for i=1:len
outImg((bifurcation_x(i)-3):(bifurcation_x(i)+3),(bifurcation_y(i)-3),1:2)=0;
outImg((bifurcation_x(i)-3):(bifurcation_x(i)+3),(bifurcation_y(i)+3),1:2)=0;
outImg((bifurcation_x(i)-3),(bifurcation_y(i)-3):(bifurcation_y(i)+3),1:2)=0;
outImg((bifurcation_x(i)+3),(bifurcation_y(i)-3):(bifurcation_y(i)+3),1:2)=0;
</pre><pre> outImg((bifurcation_x(i)-3):(bifurcation_x(i)+3),(bifurcation_y(i)-3),3)=255;
outImg((bifurcation_x(i)-3):(bifurcation_x(i)+3),(bifurcation_y(i)+3),3)=255;
outImg((bifurcation_x(i)-3),(bifurcation_y(i)-3):(bifurcation_y(i)+3),3)=255;
outImg((bifurcation_x(i)+3),(bifurcation_y(i)-3):(bifurcation_y(i)+3),3)=255;
end
figure;imshow(outImg);title('Minutiae');</pre>indrani daluihttps://es.mathworks.com/matlabcentral/profile/authors/10443060-indrani-daluitag:es.mathworks.com,2005:Question/614852013-02-02T10:18:29Z2017-06-22T16:05:15ZHow to divide an image in two blocks<p>How can I divide an image into two halves? Then, after dividing it make each half independent, say</p><p>A = top half and</p><p>B = the bottom half.</p><p>So that I can extract features from each half.</p>Jack Sparrowhttps://es.mathworks.com/matlabcentral/profile/authors/3744222-jack-sparrowtag:es.mathworks.com,2005:Question/3457802017-06-22T06:57:28Z2017-06-22T16:02:27Z็How to send video object in function to GUI in Matlab<img src = "/matlabcentral/answers/uploaded_files/81134/Untitled-1.jpg"><p>I want to send video obj use for when press start program but no data to processing and I press exit and I press start again video object <b>OBJ has already been started.</b> can't processing in program</p><p>then I want to know send video obj to GUI</p>Adisorn Phanukthonghttps://es.mathworks.com/matlabcentral/profile/authors/6937939-adisorn-phanukthongtag:es.mathworks.com,2005:Question/3458722017-06-22T15:58:35Z2017-06-22T15:58:35Zhow to use a binary mask as a "stencil" for a grayscale image?<p>Hey everyone,</p><p>I have a binary mask (first attached image) that I want to use to trace-out the image of a gray-scale picture (second attacked image) and create another image in that manner.</p><p>I tried the simple AND operation, but the newly created image is a binary, not grayscale. I want to use the mask to crop out the image, without changing anything else.</p><p>Thanks in advance for any tips!</p>Nadeem Naimhttps://es.mathworks.com/matlabcentral/profile/authors/6260814-nadeem-naimtag:es.mathworks.com,2005:Question/3453502017-06-19T14:16:08Z2017-06-22T15:57:15ZHow to copy elements of one field of structure into another new field of another structure?<p>Hello,</p><p>I have two structures, A and B.</p><p>B.data is 5X1 with each row length being 1x5.</p><pre class="language-matlab">B.data : 1x5
1x5
1x5
1x5
1x5
</pre><p>In structure A, I want to create a new field "data" and store the elements of B.data in one cell i.e.</p><pre class="language-matlab">A.data = 1x25.
</pre><p>I think it should be easy, but I am not able to copy it in this pattern. Can any one help me out with the solution.</p><p>Thanks in advance.</p>Akash Sachdevahttps://es.mathworks.com/matlabcentral/profile/authors/10417381-akash-sachdevatag:es.mathworks.com,2005:Question/3458212017-06-22T11:49:16Z2017-06-22T15:56:48ZPseudo Random Integer with frequency constraints<p>Hello,</p><p>I am relatively new to MATLAB and I need to design a 200x1 matrix, which is filled with random integers that can be either 1/2/3/4, so 4 possible numbers.
However, in the matrix I want '1' to occur 70% (thus a total frequency of 140 for number 1), '2', '3' and '4', to occur 10% (thus a frequency of 20 for 2,3 and 4).</p><p>Moreover, I want the matrix to be filled so that the values of 2,3, and 4 never display a consecutive repeat, but that 1 may feature consecutive repeats (as it takes 70%)</p><p>I had a solution (without the consecutive repeat constraint), using the repelem function. However, on the target PC, an older version of matlab is installed (2013) and does not include this function.
Could someone provide me with a solution?</p><p>Thanks</p>Jens Allaerthttps://es.mathworks.com/matlabcentral/profile/authors/9324572-jens-allaerttag:es.mathworks.com,2005:Question/3448132017-06-14T21:33:11Z2017-06-22T15:56:45ZHow to do when the inputs ranges for neural network are not so uniform in magnitude ?<p>Hi,i'm trying to create neural network for classification of EEG signal in which i extacted 9 features that i will use it as inputs for neural network but the problem is that my inputs ranges are not so uniform in magnitude i mean some input can take a very high value numerically compared to other inputs so the big numbers will mask the effect of the smaller numbers.
I used the preprocessing function 'mapminmax' but i still have a bad performance so when i do some research i found that i should Transform each input that has always a positive value into logarithm values. Matlab will take these transformed values and apply the normalization to them [-1,1]. For prediction, i should enter not the actual values but the logarithm of the input to the ANN.
So i want tp know is this right ? and can i do this transformation of my innputs with matlab?</p><p>This how my original input looks like</p><img src = "/matlabcentral/answers/uploaded_files/80518/11.png">afefhttps://es.mathworks.com/matlabcentral/profile/authors/9902982-afeftag:es.mathworks.com,2005:Question/3457702017-06-22T04:56:29Z2017-06-22T15:55:31Zhow to use Slider Switch in simulink model ?<p>How to use Slider Switch in simulink model ?
Help document write a little bit.</p>jingwie sunhttps://es.mathworks.com/matlabcentral/profile/authors/10258136-jingwie-suntag:es.mathworks.com,2005:Question/3457142017-06-21T16:53:48Z2017-06-22T15:54:01ZHow can I plot matrix locations on top of corresponding matrix elements?<p>Hi,</p><p>I have a set of 20 matrix locations (elements) which have their subscript indices stored as "xpossav" and "ypossav". These correspond to rows and columns of a matrix, C, respectively. These "coordinates" are simulated location points of a movement trajectory. I want to plot these coordinates on top of the elements in the matrix C that the coordinates correspond to. I know that matrices are indexed (rows, columns), so equivalent plotting would be (y,x). Below is the code I have used to create a plot of the coordinates, so that I can visualize the trajectory:</p><pre class="language-matlab">plot(ypossav,(size(C,1)-xpossav),'-o'),xlabel('X'),ylabel('Y'), title('Trajectory')
</pre><p>This works in plotting the locations correctly. I then want to display the subset of the matrix that corresponds to the locations. For example, the point for location xpossav=1,ypossav=1 should be shown on top of element (1,1) of matrix C. Is there a way to do this? I have tried different approaches, but can only achieve to plot the locations separately from the corresponding matrix subset.</p>Stephanie Diazhttps://es.mathworks.com/matlabcentral/profile/authors/10440972-stephanie-diaztag:es.mathworks.com,2005:Question/3451552017-06-17T16:17:50Z2017-06-22T15:52:44ZHow to check Number of channels of a sound file and convert stereo file in mono in MATLAB<p>I want to check whether the .wav file is stereo or mono.If it is stereo, convert in mono using MATLAB.How to proceed</p>Hemangihttps://es.mathworks.com/matlabcentral/profile/authors/2078416-hemangitag:es.mathworks.com,2005:Question/3458632017-06-22T15:15:13Z2017-06-22T15:51:15ZProblem setting axes position when using "camva" function<p>Hello,
I've encountered a few problems when using the "camva" function.
One of those problems is that the position of axes behaves very strangely.</p><p>1. When using camva the axes changes its size, but when requesting the new position, it says that the position is the same.
2. When trying to change the width of the axes (third position entry), the axes moves right instead.</p><p>Here is a code example that reproduces these two issues (see comments):</p><pre class="language-matlab">if true
% code
end
X = rand(10);
Y = rand(10);
Z = rand(10);
figure(1)
plot3(X,Y,Z,'o')
set(gca, 'position', [0.5 0.55 0.3 0.3])
camva(5); % the axes became larger
newPos = get(gca, 'position'); % newPos equals to the previous position ([0.5 0.55 0.3 0.3]) even though the
position has actually changed
pause;
set(gca, 'position', [0.5 0.55 0.4 0.3]) % the axes should grow wider without moving, but it moves right
instead.
</pre><p>Can you please help me with this issue.
Thank you very much,
Alexandra.</p>Alexandra Gilinskyhttps://es.mathworks.com/matlabcentral/profile/authors/9199001-alexandra-gilinskytag:es.mathworks.com,2005:Question/2515652015-10-28T22:07:00Z2017-06-22T15:51:12Zhow to use read a Huge .txt file row by row and save each row as a vector? <p>I have a huge .txt file (435483 rows), each row contains 60 measured values (at 60 time points). Now, I want to read this file into 435483 separate arrays and each array contains these 60 measured values.
My data looks like this:</p><pre class="language-matlab">row1:1 2 3 4 5;
row2:2 4 6 8 10;
row3:1 3 5 7 9;
...
</pre><p>But instead of having three rows, I have (435483 rows); instead of having 5 measured-values, I have 60.</p><p>At the end, I want to acquire 435483 arrays v_1, v_2, ...v_435483. I know that textscan() can do similar thing, but they group elements in each col instead of row.</p><p>Thank you very much for whoever can help!</p>congconghttps://es.mathworks.com/matlabcentral/profile/authors/6744667-congcongtag:es.mathworks.com,2005:Question/3458382017-06-22T13:44:34Z2017-06-22T15:51:11ZHow do I convert an array into a set of indices using colon notation?<p>I have two 4D matrices. Each is approximately 150 x 150 x 150 x 3 (the "3" is exact in both matrices).
The 4th dimension in Matrix1 specifies a location from which to extract data in Matrix2.</p><p>So, for example, if Matrix1(20,30,25,:) = [22 32 15], this is the location in Matrix2 which we want to use to extract data for that 3D location. So, the result ShiftPart1(20,30,25,:) = Matrix2(22,32,15,:).</p><p>I can calculate this in a nested loop as follows, but it is extremely inefficient, take ~ 2 minutes. I need to run these calculations thousands of times, so it must take < 1 sec. Is there a vectorized way of running this to avoid the nested loops? Thanks!</p><pre class="language-matlab">function [ShiftPart1] = getIndexShift(Matrix1, Matrix2)
size1 = size(Matrix1);
for j = 1:size1(1),
for k = 1:size1(2),
for sl = 1:size1(3),
ShiftPart1(j,k,sl,1:3) = squeeze(double(Matrix2(Matrix1(j,k,sl,1:3))));
end,
end,
end
</pre>Mark Wagshulhttps://es.mathworks.com/matlabcentral/profile/authors/606291-mark-wagshultag:es.mathworks.com,2005:Question/3458692017-06-22T15:49:07Z2017-06-22T15:50:26Z??? Error: File: Untitled2.m Line: 16 Column: 22 Unbalanced or unexpected parenthesis or bracket.<p>clc;
clear all;
close all;
T1=('enter the value of T1');
T2=('enter the value of T2');
T3=('enter the value of T3');
t1=('enter the value of t1');
t2=('enter the value of t2');
t3=('enter the value of t3');
s1=(T1/t1)*(T2/t2)*(T3/t3);
s2=((t1.^-1.)+(t2.^-1.)+(t3.^-1.));
To=(s1./s2);
to=(1./s2);
f=to/To;
x=[0:0.1:1];
y=1+(f-1)*exp(-x./To.);
xlabel('time intervel');
ylabel('poi');
plot(x,y)</p>vikram bishthttps://es.mathworks.com/matlabcentral/profile/authors/8281863-vikram-bishttag:es.mathworks.com,2005:Question/3458702017-06-22T15:50:17Z2017-06-22T15:53:29ZI am trying to make a graph that has multiple equations<p>Hello everyone,</p><p>I am trying to make a graph that fits XRD data. I am new to matlab programming and have been unable to make this graph. My graph needs to have start/stop points at both ends of the graph that are fitted to a line. For example if my data ranges from 1-641 and my peaks are at somewhere between 11-630 I need two lines from 1-10 and 630-641 (this accounts for background). I then need to make a full equation that adds my two lines plus the sum of five equations I used to fit the peaks. I have been able to successfully fit the peaks but every time I try to add the lines in a F = linefit + sumofmyequations I get an error in dimensions. I do not know how to get my linefit to be the same dimension as my sumfit. I am also having trouble with the start/stop. I've been doing
start = {1:10, 630:641}
stop = {10:630}
which I had hoped would display my numbers.
Any help would be great!</p>Sharon Morganhttps://es.mathworks.com/matlabcentral/profile/authors/10483557-sharon-morgantag:es.mathworks.com,2005:Question/3458572017-06-22T14:54:51Z2017-06-22T15:49:53ZIs it possible to take data from a CSV file, plot it and then perform an FFT with the end goal of finding the primary frequencies?<p>I have been able to take my CSV file and plot it fairly easily but is there a way to create a frequency plot using FFT without prior knowledge of the sample rate or period?</p>Matthew Harkerhttps://es.mathworks.com/matlabcentral/profile/authors/10511926-matthew-harkertag:es.mathworks.com,2005:Question/3078292016-10-18T09:37:17Z2017-06-22T15:48:30ZOSX and Mac Performance<p>I have two apple computers and thought it would be an interesting to compare performance (computer spec below)</p><p>COMPUTER A</p><ul><li>Model Name: Mac Pro</li><li>Model Identifier: MacPro6,1</li><li>Processor Name: 6-Core Intel Xeon E5</li><li>Processor Speed: 3.5 GHz</li><li>Number of Processors: 1</li><li>Total Number of Cores:6</li><li>L2 Cache (per Core): 256 KB</li><li>L3 Cache: 12 MB</li><li>Memory: 64 GB</li></ul><p>COMPUTER B</p><ul><li>Model Name: MacBook Air</li><li>Model Identifier: MacBookAir6,2</li><li>Processor Name: Intel Core i7</li><li>Processor Speed: 1.7 GHz</li><li>Number of Processors: 1</li><li>Total Number of Cores:2</li><li>L2 Cache (per Core): 256 KB</li><li>L3 Cache: 4 MB</li><li>Memory: 8 GB</li></ul><p>I use a simple fft() in a loop to test performance</p><pre class="language-matlab">function [ X ] = test( x )
a = 1:10000000;
for i = a
fft(x);
end
end
</pre><p>The performance is measured by timeit()</p><pre class="language-matlab">>> x = randn(8,1)
>> temp = @() test(x)
>> timeit(temp)
</pre><p>Computer A = 15.1 seconds
Computer B = 11.1 seconds</p><p>The MacBook Air spanks the Mac Pro for performance</p><p>Why is this the case?</p>CustomBuilthttps://es.mathworks.com/matlabcentral/profile/authors/4534346-custombuilttag:es.mathworks.com,2005:Question/3457872017-06-22T07:34:35Z2017-06-22T15:48:00ZI'm looking to create another push button which will convert browse image to binary of the image I read in, I'm not sure how to define the image under the new function as the image that was chosen previously, could any one help, <pre class="language-matlab">function process_Callback(hObject, eventdata, handles)
% hObject handle to process (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
%convert binary Image
binary_image = binary_image(120:400,20:250);
figure;imshow(binary_image);title('binary image');
%Small region is taken to show output clear
binary_image = binary_image(120:400,20:250);
figure;imshow(binary_image);title('binary_image');
</pre>indrani daluihttps://es.mathworks.com/matlabcentral/profile/authors/10443060-indrani-daluitag:es.mathworks.com,2005:Question/3458522017-06-22T14:26:30Z2017-06-22T15:44:20ZOffering Matlab Tool on a webpage using a grafical frontend while calculation runs on a backend server<p>Hi everybody,</p><p>i would like to offer the functionality of some matlab-tools on a webpage. The tools have fixed in- and outputs. The input consists of a set of values and the output should be displayed on the webpage as well.</p><p>The problem is, that i would like to calculate the request in a centralized server in order to register all requests including the in- and output-data. As more than one person can send a job in a time, a job management propably is required, too. I also do not know how to best establish the interface between the job-management (handling the data) and the frontend (grafical in- and output on the webpage).</p><p>I would very much look forward to existing solution that are similiar, or hints and tipps for libraries or solutions that might be useful in that context.</p><p>regards,
ca</p>Chr Anghttps://es.mathworks.com/matlabcentral/profile/authors/5478027-chr-angtag:es.mathworks.com,2005:Question/3453602017-06-19T15:38:37Z2017-06-22T15:41:14ZHow to put 2 subplots as 1 subplot without merging their data?<p>I have created five subplots in one figure, where the data was grouped based on the country, say: Country A, B, C, D and E.</p><p><b>Question:</b> Instead of having five subplots, now I want only four subplots, where the subplots of C and D are to be merged as one subplot, i.e. subplot 1: A, subplot 2: B, subplot 3: C & D and subplot 4: E. How to modify my code below?</p><p><b>Condition:</b> Although the C & D are put together, I still want their results are shown individually in the same subplot 3.</p><pre class="language-matlab">figure (01)
[u_Country, ~, idx] = unique(Table1.Country);
for k = 1:5
subplot(3,2,k)
mask = idx == k;
f1 = gscatter(Table1.x(mask), Table1.y(mask), Table1.Country(mask), 'mgbrk', 'xxxxx');
xlim([0 100]);
ylim([20 50]);
legend(f1((u_Country(k))), 'Location', 'northeast');
end
</pre>wesleynotwisehttps://es.mathworks.com/matlabcentral/profile/authors/10338091-wesleynotwisetag:es.mathworks.com,2005:Question/3458202017-06-22T11:44:46Z2017-06-22T15:39:58ZCalculate signal/band occupancy of each signal which exceeds a threshold?<p>I am analysing an arbitrary band of the frequency spectrum and need to measure the percent of time during the total number of sweeps which each signal exceeds the threshold. I have code which works for a band which contains only one signal which exceeds the threshold. In the figure attached shows all the signals excceding the threshold, at 862 MHz and 894MHz are two signals which are constantly on. the goal of the program is to ignore signals that are 'on' less than 50% of the sweeps and to record those that are 'on' more than 50%</p><p>thanks</p><p>for ii= 1:numCapture
xlim([startFreqMHz stopFreqMHz])
ylim([-105 -50])
smoothData = smooth(sweepData,0.005,'loess');
[sweepData,startFreqMHz,stopFreqMHz,numSamples,freqs] = step(sweep_cap);</p><pre> % save('sweepData.txt','sweepData','-ASCII','-append');
% Plot spectrum
mean = sum(smoothData)/length(smoothData);
threshold = mean+5;
smoothData(smoothData<=threshold) = threshold;
plot(freqs(1:numSamples),smoothData(1:numSamples),'MarkerSize', 10);
title(['Spectrum ' num2str(sweep_cap.startFreqMHzReq) '-' num2str(sweep_cap.stopFreqMHzReq) ' MHz '...
'(' num2str(sweep_cap.bandwidthHz) ' Hz resolution BW)']);
xlabel('Frequency (MHz)');
ylabel('Power (dBm)');
hold on;</pre><pre> x = freqs;
y = smoothData;</pre><pre> morethanthreshold = y > threshold;</pre><pre> over_x = x(morethanthreshold);
over_y = y(morethanthreshold);</pre><pre> plot(over_x, over_y, 'r*')
reset(gca)
xlim([startFreqMHz stopFreqMHz])
ylim([-105 -50])
xlabel('Frequency (MHz)');
ylabel('Power (dBm)');
title(['Spectrum ' num2str(sweep_cap.startFreqMHzReq) '-' num2str(sweep_cap.stopFreqMHzReq) ' MHz '...
'(' num2str(sweep_cap.bandwidthHz) ' Hz resolution BW)']);
end</pre>Veronica yephttps://es.mathworks.com/matlabcentral/profile/authors/6202404-veronica-yeptag:es.mathworks.com,2005:Question/3457072017-06-21T16:18:12Z2017-06-22T15:39:40ZUse inputs of a user defined Matlab function block as global variables whithin the block<p>In my simulink model there is a Matlab function which consists of many functions:</p><pre class="language-matlab">function block_output = MatFun1(input1, input2, ...)
...
block_output = MatFun2(x, t)
end
</pre><pre> function y = MatFun2(x, t)
y = f(x, t, input1, input2, ...)
end</pre><p>Mathematically MatFun2 is just a function of x and t. Therefore, I would like to keep the notation intact. However, the function requires the block's inputs as well. I tried to globalize the variables input1, input2, ... to be able to use them in MatFun2 as well:</p><pre> function block_output = MatFun1(input1, input2, ...)
global block_inputs
block_inputs = [input1, input2, ...]
...
block_output = MatFun2(x, t)
end</pre><p>However, I encounter the following error:</p><pre> Global declaration not resolved to a Data Store Memory block registered via the Ports and Data Manager.</pre><p>As I mentioned, I do not want to pass input1, input2, ... to MatFun2 as arguments. Moreover, I want these variables to be known just within this block (not the whole simulink model). Nested functions are also not desirable.
What options do I have and how can I resolve the problem?</p>Ali Baradaranhttps://es.mathworks.com/matlabcentral/profile/authors/7395532-ali-baradarantag:es.mathworks.com,2005:Question/3458682017-06-22T15:38:10Z2017-06-22T15:42:30ZRecurrent initialization of SeriesNetwork (Simple init?)<p>Hi everyone,</p><p>I would like to implement an initialization of the weights of the network that rely on the images that will go through the network I saw in a paper. That means that after having a SeriesNetwork ready, I compute the activations of the layers in response of several images and would like to update the layers wights and bias accordingly. However, those fields are read only. So my only solution is to change the weights of the layers directly and create a new network that I have to fakely train with a very low learning rate. Is there no way to simply initialize a SeriesNetwork without training? I saw the init function but it is for network, not a seriesNetwork.
So my question is, <b>How can I avoid training the network when I just want to compute the activations with a known set of weights for the various layers?</b></p><p>An example of the current solution:</p><pre class="language-matlab">net=vgg16;
layers=net.Layers();
[weights, bias]=[weights0, bias0];
while(init)
layers(10).Weights = weights;
layers(10).Bias = bias;
optionsTransfer = trainingOptions('sgdm','MaxEpochs',1,'InitialLearnRate',1e-50);
[newNet,~] = trainNetwork(trainDigitData,layers,optionsTransfer);
features = activations(newNet,trainDigitData,10);
[weights,bias]=fct(features)
layers=newNet.Layers()
end
</pre><p>My ideal solution:</p><pre class="language-matlab">net=vgg16;
layers=net.Layers();
[weights, bias]=[weights0, bias0];
while(init)
layers(10).Weights = weights;
layers(10).Bias = bias;
%initialization without training
newNet = initializeNetwork(layers);
features = activations(newNet,trainDigitData,10);
[weights,bias]=fct(features)
layers=newNet.Layers()
end
</pre><p>So how can I get an equivalent for my hypothetic initializeNetwork function? Or can I bypass the read-only attribute?</p><p>Thanks a lot!</p><p>Carole</p>Carolehttps://es.mathworks.com/matlabcentral/profile/authors/7152523-caroletag:es.mathworks.com,2005:Question/3458092017-06-22T10:28:03Z2017-06-22T15:37:53ZHow to get correct values of a(n) from this equation. Attached is my code but it gives wrong values. where n=1...5,<p>clc; close all; clear
d=0.5; N=10;
for n=1:N/2
sum=0;
fderiv = @(f,x) (f(x+eps)-f(x))/eps; % Derivative of a function
xderiv = @(x) ((x+eps)-x)/eps; % Derivative of an expression
for k = 1:(N/2)
x(k)=sin(2*(k+n-1)*pi/N)/(k+n-1) + sin(2*(k-n)*pi/N)/(k-n);
if isnan( x(k) ) % Test for ‘NaN’
x(k) = fderiv(@sin, 2*(k-n)*pi/N)/(xderiv(k-n)); % L'Hospital's Rule
end
end
sum=sum+x;
an = (2/(N*pi))*(pi-sum);
end
display(an);% this is not giving the correct values?????
an_manually=[-0.5736 -0.4197 -0.1352 0.2383 0.6486] % these are correct values</p>Tariqhttps://es.mathworks.com/matlabcentral/profile/authors/576730-tariqtag:es.mathworks.com,2005:Question/3458652017-06-22T15:22:37Z2017-06-22T15:37:05Zwho to draw logical charts<p>Hello,</p><p>I'm a bio ingeneer student trying to prepare myself for a matlab exam, and I don't understand the correction of this exercice. Do you know what is Nor and Xor about ? I don't find informations on matlab help.</p><p>Thank you very much</p>Pestiaux Mariannehttps://es.mathworks.com/matlabcentral/profile/authors/10317030-pestiaux-mariannetag:es.mathworks.com,2005:Question/3458222017-06-22T12:19:14Z2017-06-22T15:35:45ZHow to save vector columnwise in Excel file<p>Suppose I am generating a column vector randomly 30 times and each time I wish to save it in the Excel column. Can anybody tell me how to do it.</p><pre class="language-matlab">for i=1:30
vec = randn(5,1);
</pre><pre> %% Save vec in excel file</pre><pre class="language-matlab">end
</pre>Atinesh Singhhttps://es.mathworks.com/matlabcentral/profile/authors/8382894-atinesh-singhtag:es.mathworks.com,2005:Question/3458262017-06-22T12:41:57Z2017-06-22T15:33:48ZWhat's the best color model to extract texture features from?<p>Just like L*a*b is the best color model to extract color features from images because it matches human color perspective,what is the best color model to extract GLCM texture features from and why</p>Elias Unkhttps://es.mathworks.com/matlabcentral/profile/authors/9640772-elias-unktag:es.mathworks.com,2005:Question/3458602017-06-22T15:09:34Z2017-06-22T15:30:27ZWriting Constaints for simulannealbnd <p>I am trying to optimize an objective using simulannealbnd function. I have constraints of upper and lower bounds on decision variable x. The constraints are: x > 0 and sum(x)< Maximum_Average_Price. I have coded as follow but the resultant sum(x) goes beyond Maximum_Average_Price. I would appreciate any help.</p><pre class="language-matlab">x0=[price(1:4), priceDash(5:28)];
lb = ones(1,28);
ub= min(sum(x0), price_avg_max);
</pre>Saifullah Khalidhttps://es.mathworks.com/matlabcentral/profile/authors/9710909-saifullah-khalidtag:es.mathworks.com,2005:Question/3458672017-06-22T15:29:48Z2017-06-22T15:29:48Zhow is Xlabel used on a mapping plot<p>Why doesn't >> xlabel('name') work on a map?</p>David Weissmanhttps://es.mathworks.com/matlabcentral/profile/authors/45167-david-weissmantag:es.mathworks.com,2005:Question/1514302014-08-19T05:33:12Z2017-06-22T15:29:27Zhow to count pixel in binary image ?<p>Hi, i'm trying to counting a binary image on handwritting. how to count a high string using pixel? example for counting high of alphabet A.</p>ayriehttps://es.mathworks.com/matlabcentral/profile/authors/5528217-ayrietag:es.mathworks.com,2005:Question/3458662017-06-22T15:28:38Z2017-06-22T15:28:38ZR2016b 2D zoom is not smooth. <p>Using R2016 the zooming in on data on 2D plot figures is very steppy. Not smooth like versions before. Like there is a "Snap to" feature. How can I get the zoom feature to act like R2015B and all earlier versions? Thanks.</p>Jonhttps://es.mathworks.com/matlabcentral/profile/authors/371064-jontag:es.mathworks.com,2005:Question/3450862017-06-16T18:05:49Z2017-06-22T15:28:37ZNonlinear regression + Cross Validation = possible?<p>Hello. World. I want to know is it possible to perform cross validation on nonlinear regression model?</p>wesleynotwisehttps://es.mathworks.com/matlabcentral/profile/authors/10338091-wesleynotwisetag:es.mathworks.com,2005:Question/3458452017-06-22T14:06:48Z2017-06-22T15:26:42Zcreate oblique cylinders and upright cylinder mesh in different positions<p>hi how to create three oblique cylinders and upright cylinder mesh in same figure the three upright/oblique cylinders in different positions and one of them has different degree with( intersect) other cylinder ths u</p>kao Stevenhttps://es.mathworks.com/matlabcentral/profile/authors/9152360-kao-steventag:es.mathworks.com,2005:Question/3457402017-06-21T20:07:12Z2017-06-22T15:24:20ZHow to export a bode plot magnitude and phase to excel<p>I am very new to Matlab. The transfer function I am working with is much more difficult than the one below, but what I want to do will is not impacted by the function. I have a bode plot I am generating:</p><pre class="language-matlab">H = tf([1 0.1 7.5],[1 0.12 9 0 0]);
bode(H)
</pre><p>I get a plot of magnitude in dB and phase in degrees, both across rad/sec. I am looking for absolute magnitude (not dB), radians (not degrees) and the the x-axis should he Hertz. I am then wanting to export the data into Excel (magnitude in the first column and phase in the second) from, for example, 10Hz to 100Hz in 10Hz steps. Can someone please assist me in doing this. It would be greatly appreciated. Thanks!</p>Gerald Meritshttps://es.mathworks.com/matlabcentral/profile/authors/6222916-gerald-meritstag:es.mathworks.com,2005:Question/3457322017-06-21T18:59:10Z2017-06-22T15:21:54Zfunction approximation using any optimization routine<p>I've two linear equs:
x1+x2=10 & x1-x2=2;</p><p>I would like to solve these using any optimization method for which these have to convert into a single function;
In excel:i am doing this by excel solver by minimising sum sq deviation (initially assuming any values for x1 & x2);
pl. help how to do it in matlab!
Ex: I try to apply ga; but fail to make the needed fitness function!</p>ARUN BORGOHAINhttps://es.mathworks.com/matlabcentral/profile/authors/3453952-arun-borgohaintag:es.mathworks.com,2005:Question/3454132017-06-19T21:22:19Z2017-06-22T15:21:09ZHow can I calculate permanent function from a non-quadratic matrix?<p>Dear, i'm make my pregrade thesis then i will evaluate the territorial planning from a watershed by the graph theory. This is make by a nxn matrix. I use the function in Matlab (URL: <a href = "https://www.mathworks.com/matlabcentral/fileexchange/22194-matrix-permanent">https://www.mathworks.com/matlabcentral/fileexchange/22194-matrix-permanent</a>), moreover value standardisation, because it's from a expert opinion.</p><p>The problem it's about in some systems give a mxn matrix and I can't solve this way.</p><p>My question is How can I evaluate a mxn matrix by graph theory?</p><p>Thank you for your answers.</p>Tania Guerrerohttps://es.mathworks.com/matlabcentral/profile/authors/10498714-tania-guerrerotag:es.mathworks.com,2005:Question/3453622017-06-19T16:00:20Z2017-06-22T15:20:23ZLocation of TCP Server Configure?<p>There is a simulink example at this page:</p><p>https://www.mathworks.com/help/xpc/examples/target-to-target-communication-using-tcp.html</p><p>but the referenced models TargetToTargetServer and TargetToTargetClient are not available. In which toolbox are these located? I have Instrument control and Communication. Thanks.</p>Nina Buchananhttps://es.mathworks.com/matlabcentral/profile/authors/10377540-nina-buchanantag:es.mathworks.com,2005:Question/3456052017-06-21T04:14:59Z2017-06-22T15:18:51ZHow do i fix my neuronal network (Urgent)<p>Hello everybody,
this is my first post so i hope im not breaking any rule or something like that.</p><p>Situation: Im working on a neuronal network on matlab (Not using nntool) and after 3 months i cant make it work as i expected.</p><p>Details: Is a classification Network with 45 inputs (all numeric) and one output (0, 0.5 and 1)</p><p>Problem: i have create my network and it works but im getting 63% of good responses and ofcourse this is not acceptable for my work. I have tried adding multiples hidden neurons (from 1 to 25) and the response is always de same, even if i change my inputs from 45 to 22 or 2. Also i tried to add epochs and change my activation function. but it didnt work aswell. Im really desperate since i have working on this for while and i cant get a solution.</p><p>My net: net = newff([inputs], [10 1] ,{'purelin','poslin'});
Inputs are numeric and there are no negative values.</p><p>Example of input:
1 2 6 2 1 2 3 0 31 6 16 0 0 0 414 411 250 9 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 0 0 0 0 0 0 0</p><p>i dont know if you need more details but feel free to ask.</p><p>Any kind of help would be appreciate.</p><p>Thanks you in advance to everyone.</p><p>PS: I need to use neuronal network thats the only requeriment for my project.</p>Ricardo Gonzalezhttps://es.mathworks.com/matlabcentral/profile/authors/10504768-ricardo-gonzaleztag:es.mathworks.com,2005:Question/3458462017-06-22T14:07:46Z2017-06-22T15:18:41ZHow can a make a matrix which keeps on updating itself and after the loop is over its saves it as a cvs file?<p>I am trying to make a matrix which keeps on updating itself with the value of coefficients(in my code) in a for loop and after the loop is over it save the matrix as a cvs file. Below is my code. Any help would be appreciated.</p><pre> for k=1:100
data=sprintf('%d_1.csv',k);
com_data=load(data);
com_data=load('1_1.csv');
voltage=com_data(:,2);
voltage_freq=fft(voltage);
voltage_freq_mag=abs(voltage_freq);
threshold=voltage_freq_mag(29);
a=find(voltage_freq_mag >= threshold);
for i = a
voltage_edit=voltage_freq(i);
end
coefficients=voltage_edit(1:9)
csvwrite('set1',coefficients)
end</pre>Atharva Hanshttps://es.mathworks.com/matlabcentral/profile/authors/7520837-atharva-hanstag:es.mathworks.com,2005:Question/2722892016-03-09T08:58:35Z2017-06-22T15:14:18ZSimulink Coder to Vector CANape Real-Time Target DLL causes error: "Reference to non-existent field 'ShortName'."<p>Hello,</p><p>I'm trying to buit code for Vector Canape out of my Simulink Model.
No matter if I use my actual model or just a model containing a single sine wave generator and a scope, it is giving me the following error during the building:</p><p>"Reference to non-existent field 'ShortName'" (see Apprendix I, last line).</p><p>Im using...</p><ul><li>Windows 8.1 64Bit,</li><li>Matlab 8.6.0.267246 (R2015b)</li><li>Simulink version: 8.6</li><li>CANape MATLAB Integration Package 13.0.0 (64 bit)</li><li>Visual Studio 2015</li></ul><p>Code Generation...</p><ul><li>Target File: cnp.tlc</li><li>Language C</li></ul><p>Modell...</p><ul><li>Sine wave generator and a scope</li><li>Start time 0.0 Stop time 1</li><li>Fixed time step 0.1</li><li>Solver ode3</li></ul><p>Can anyone help me?</p><p>Apprendix I:</p><p>Generation 2 1
Elapsed: 32 sec
### Generating code into build folder: F:\01_Master_Thesis\06_Software\40_Simulink\02_V2\test_cnp_rtw
Objectives unspecified. You must specify objectives in the Configuration
Parameters > Code Generation pane before checking model.
### Invoking Target Language Compiler on test.rtw
### Using System Target File: C:\Program Files\MATLAB\R2015b\rtw\c\canape\cnp.tlc
### Loading TLC function libraries
### Initial pass through model to cache user defined code
.
### Caching model source code
### Writing header file test.h
.
### Writing header file test_types.h
### Writing header file rtwtypes.h
### Writing header file builtin_typeid_types.h
### Writing header file multiword_types.h
### Writing header file zero_crossing_types.h
### Writing source file test.c
.
### Writing header file test_private.h
### Writing header file rtmodel.h
### Writing header file rt_nonfinite.h
### Writing source file rt_nonfinite.c
### Writing header file rt_defines.h
### Writing header file rtGetInf.h
.
### Writing source file rtGetInf.c
### Writing header file rtGetNaN.h
### Writing source file rtGetNaN.c
### TLC code generation complete.
### Generating TLC interface API.
.
### Creating ASAP2 file: test.a2l
.
### Indenting ASAP2 file.
.
### Processing Template Makefile: C:\Program Files\MATLAB\R2015b\rtw\c\canape\cnp_msdll.tmf
Reference to non-existent field 'ShortName'.</p>H Shttps://es.mathworks.com/matlabcentral/profile/authors/6436051-h-s