https://kr.mathworks.com/matlabcentral/answers/questionsMATLAB Answers — New Questions2019-04-20T10:23:28Ztag:kr.mathworks.com,2005:Question/4575042019-04-20T09:02:51Z2019-04-20T10:23:28ZWhen running code it returns >> pp01 Error using plot Error in color/linetype argument. Error in pp01 (line 33) plot(t(:),z(:,1),'W',t(:),z(:,2),'F')function pp01
clear
global As Qt g A c
As=15;
Qt=10;
g=9.81;
A=(121/64)*pi;
c=0.02;
z1_initial=10;
z2_initial=25;
N=1000;
h=0.5;
t=zeros(N,1);
z=zeros(N,2);
t(1)=0;
z(1,1)=z1_initial;
z(1,2)=z2_initial;
for n=1:N-1
t(n+1)=t(n)+h;
z(n+1,:)=z(n,:)+h*f(t(n),z(n,:));
z(n+1,:)=z(n,:)+0.5*h*(f(t(n),z(n,:))+f(t(n+1),z(n+1,:)));
end
%plot(t(:),z(:,1),'W',t(:),z(:,2),'F')
Figure 2
Plot(z(:,1),z(:,2))
[t,z];
return
function dzdt=f(~,z)
global As Qt g A c
%dzdt(1)=z(2);
%dzdt(2)=-z(1);
dzdt(1)=(1/As)*(z(2)-Qt);
dzdt(2)=-g*(A/2)*(z(1)+(c*abs(z(2))*z(2)));
return
Lucy Raistrickhttps://kr.mathworks.com/matlabcentral/profile/authors/15335284-lucy-raistricktag:kr.mathworks.com,2005:Question/4575102019-04-20T10:01:21Z2019-04-20T10:22:11Zxlsread function and rangesdata1 = xlsread('data1.xlsx', 'sheet1', 'A1:B48')
my spreadsheet has data for each day of a month (day 1 to day 30) day 1 equals the range A1:B48, day 2 would be A49:B96 etc so the nth term would be 48n - 47 for A and 48n for B where n = day of the month. how can i incorporate the nth term into the xlsread function so that anyone can choose any value of n between 1 and 30 (here i can also use the opportunity to use if statement) and it'll generate the xls read function for that given day? can i even put a formula in for the range in xlsread function?huy hohttps://kr.mathworks.com/matlabcentral/profile/authors/15021439-huy-hotag:kr.mathworks.com,2005:Question/4574992019-04-20T07:35:15Z2019-04-20T10:19:28ZHow can I solve this centroid related problem ?I have a binary image. I want to consider the upper portion of the centroid only. Then for a particular length I want to consider two square from both sides of centroid . I have attached two pictures to give an idea. Zara Khanhttps://kr.mathworks.com/matlabcentral/profile/authors/10893209-zara-khantag:kr.mathworks.com,2005:Question/4574962019-04-20T07:10:46Z2019-04-20T10:19:07ZHow to assign values to variables and calculate equation?In GUI table, I enter an equations (like '((VDD-VSS)*(Id_M5+(2*(Id_M7))))/(CL*Cc)*Vth_M5^2*Cc').
I split this equations using,
output = regexp(S, '[ ()^*+/-]+', 'split');
output(cellfun(@isempty, output)) = []
I get,
output = 'VDD' 'VSS' 'Id_M5' '2' 'Id_M7' 'CL' 'Cc' 'Vth_M5' '2' 'Cc'
and I have its corresponding values,
ComVal = 1.800000000000000 -1.800000000000000 0.000011200000000 2.000000000000000 0.000010400000000 0.000000000002000 0.000000000010117 0.367000000000000 2.000000000000000 0.000000000010117
class of ComVal is double.
Now, how do I calculate the value of the equation entered?
Thank You.Harsha M Vhttps://kr.mathworks.com/matlabcentral/profile/authors/8626163-harsha-m-vtag:kr.mathworks.com,2005:Question/4575122019-04-20T10:16:25Z2019-04-20T10:16:25ZHow to integrate with SAP ERPWe want to use sAP eRP data for MathLabs . Pl suggest how to integrate directly to the sAP ERPDathuram Jadhavhttps://kr.mathworks.com/matlabcentral/profile/authors/15335572-dathuram-jadhavtag:kr.mathworks.com,2005:Question/4575032019-04-20T08:59:24Z2019-04-20T10:15:17ZHow to randomly divide an M by M region into n I what to randomly divide a sqaure region (20 by 20) into 3 portions (not necessary square in shape).
Then randomly deploy points in the 3 regions.
I tried the code below but not getting what i want. I need random divisions (different shapes e.g one portion can be a trapezoid and so on)
m=20;
for i=1:1:m;
n(i)=rand.*0.25.*m;
b(i)=(0.25 +(0.25).*rand).*m;
c(i)=(0.5 +(0.25).*rand).*m;
end
plot (n, '+r')
hold on
plot (b, 'ok')
hold on
plot (c, 'vg')
hold off
Please help
The above code gives divisions along horizontal lines
figure 1.
I need something like the above figure 1.
Shamsuddeen Abdullahihttps://kr.mathworks.com/matlabcentral/profile/authors/10689917-shamsuddeen-abdullahitag:kr.mathworks.com,2005:Question/4574652019-04-20T00:10:33Z2019-04-20T10:12:18ZVariable in a simulink state space matrixHow can I implement a matrix in a state space model in simulink that has a variable that is dependent on another component of the model signal such as an angle etc?
I have tried sending the signal to the workspace and calling in the matrix with a variable (of the same name) in it and it does not work.
Thank you.Sugshttps://kr.mathworks.com/matlabcentral/profile/authors/6185328-sugstag:kr.mathworks.com,2005:Question/4575112019-04-20T10:12:07Z2019-04-20T10:12:07ZHow can I extract the time column of a timetableHi,
I need to extrct the time column of a timetable as I need to manipulate it.
any Ideas?Antonio Melienihttps://kr.mathworks.com/matlabcentral/profile/authors/14992125-antonio-melienitag:kr.mathworks.com,2005:Question/4574632019-04-19T23:50:21Z2019-04-20T10:05:24ZSlow plotting in App DesignerHello! I am measuring signals in real time and I need to represent the signal in a graph. When I use datetick, the graph becomes very slow.
Is there any way to represent the real time signal in a efficient way?
h1 = animatedline(app.UIAxes,nan,nan,'Color','b','LineWidth',1.5);
app.UIAxes.YGrid = 'on';
startTime = datetime('now');
while ~app.stopLoop
serialRead = fscanf(arduino,'%d');
voltage = serialRead*(1100/1023);
y = bandpass(app,voltage);
t = datetime('now') - startTime;
% Add actual measurement
addpoints(h1,datenum(t),y);
% Update Axis
app.UIAxes.XLim = datenum([t-seconds(15) t]);
datetick(app.UIAxes,'x','keeplimits')
drawnow limitrate
endIzan Segarrahttps://kr.mathworks.com/matlabcentral/profile/authors/6999599-izan-segarratag:kr.mathworks.com,2005:Question/4575092019-04-20T09:48:01Z2019-04-20T09:48:01ZBuild a new reference frame and generate rotation matrix between old and new reference frame I have a 3D body with a cilinder on the side. Matlab automatically set the reference frame in the center of the object.
I want to change the reference frame, setting the new in the center of the cylinder, with the Z axis = cylinder axis and x and y direction between the center of my cylinder and 2 point on the body.
The cylinder center and direction, and the 2 points coordinates are known. gaetano mallardohttps://kr.mathworks.com/matlabcentral/profile/authors/14383553-gaetano-mallardotag:kr.mathworks.com,2005:Question/4575082019-04-20T09:42:11Z2019-04-20T09:42:11Z Simpliﬁed Two-Diode Model of Photovoltaic (PV) Module on simulation?Hello!I hope every one will be good in health. Can anybody provide me Simpliﬁed Two-Diode Model of Photovoltaic (PV) Module on simulation?Engr Hassanhttps://kr.mathworks.com/matlabcentral/profile/authors/14314634-engr-hassantag:kr.mathworks.com,2005:Question/4573592019-04-19T11:59:07Z2019-04-20T09:40:51ZEditing a Colormap in MATLABHello guys,
I have seen video about edit a colormap https://www.mathworks.com/videos/interactively-editing-a-colormap-in-matlab-97147.html , but i don't know, how to save the setting after I edit values. Specific example ... I edit map on the top with the cursor of mouse (move positive and negative values to the center - zero). How can I get this setting always?
martin martinhttps://kr.mathworks.com/matlabcentral/profile/authors/9175560-martin-martintag:kr.mathworks.com,2005:Question/4567722019-04-16T20:08:22Z2019-04-20T09:37:33ZHow to concentrate matrices of different row length (same column length) into one matrix by unfolding each of the matrices to the smallest row length conatining numbers not nanHi all,
I am new to MATLAB, and I also asked previously something similar and got pretty good answer but I am not quite sure how to solve the issue which I didn't explain quite well. So, I have some 1010 matrices which have different row lengths but same number of columns. So I have matrices lets say 75x50, 73x50, 74x50, 85x50, 83x50, etc. But within each matrix, lets say the first one 75x50, columns have different lengths with numbers and then are filled with nan. Firstly, I want to crop them all into the smallest length of the column which contains only numbers and then in the other case extend all the matrices to the largest row length when filling with nan. I want to unfold matrices and concetrate them in a single matrix. Below the code crops the matrices at the smallest length of rows but not the smallest length of rows where all the columns contain only numbers and not nan.
Thank you in advance!
%% Initialize variables.
d='directory';
for i=1:1010
filename = [d sprintf('/name%05d/csvnames.csv', i)];
delimiter = ',';
startRow = 2;
%% Create output variable
frametable1final1 = cell2mat(raw);
H(i).matrix = frametable1final1(:,[2 3 13 14 15 16 17 18 19 20 24 36 48 49 50 58 59 60 72 73 74 75 76 88 89 90 91 99 263 316 317 318 320 344 357 870 910 927 928 929 948 949 950 969 970 971 975 976 977 981]);
end
minheight = min(arrayfun(@(s) size(s.matrix, 1), H)); %get height of each matrix and get minimum
trimmed = arrayfun(@(s) reshape(s.matrix(1:minheight, :), 1, []), H, 'UniformOutput', false); %trim and reshape matrices
X = vertcat(trimmed{:}); %vertically concatenate the lot
maxheight = max(arrayfun(@(s) size(s.matrix, 1), H)); %get height of each matrix and get maximum
padded = arrayfun(@(s) reshape([s.matrix; nan(maxheight - size(s.matrix, 1), size(s.matrix, 2))], 1, []), H, 'UniformOutput', false); %pad and reshape
Xprime = vertcat(padded{:});
Spresihttps://kr.mathworks.com/matlabcentral/profile/authors/12750159-spresitag:kr.mathworks.com,2005:Question/4575052019-04-20T09:05:42Z2019-04-20T09:35:35ZFind cell and return index Hi everyone,
a = { {21 3 1}, {22 32 2}, {21 31 2}, {22 32 1} };
I would like to know the locations of the cells containing a specific value- {21 31 1}
In this case, it's 1.
I try to use like below:
Match = {21 31 1};
CorrectMatch = find (cellfun(@(x) isequal (x,Match), a(1,:)));
but it doesn't work out
Could any one help me?
Ting-Yu Chuehhttps://kr.mathworks.com/matlabcentral/profile/authors/14644923-ting-yu-chuehtag:kr.mathworks.com,2005:Question/4575062019-04-20T09:24:32Z2019-04-20T09:33:31ZHow to perform feature matching using GPU on Windows machine Hello, I am having memory problem on my Windows machine while using feature matching function for a sequence of image data (resolution: 1920x1080). I am using ORB feature detector for feature detection and extraction. The machine I am using has 16 GM memory with Intel Core i7 @ 3.20 GH processor. I also have a GPU Radeon RX590 Series but I don't get how to use it for feature matching on Windows. The example given is only supported on Linux OS.
Please guide me how can I solve memory problem?
Thank you in advance.jhzhttps://kr.mathworks.com/matlabcentral/profile/authors/12501670-jhztag:kr.mathworks.com,2005:Question/4575072019-04-20T09:28:42Z2019-04-20T09:28:42Zi want to give coloring for 10 nodes with 4 colors using Backtracking algorithm,and give colors for 6 nodes and 4 nodes at a time.i have written code but there is a problem in recursive loop.it cant come out of the loop.please help me to do this.clc;close all;clear all;
v=[1 3 9 10 2 4 5 6 7 8 6 2 8 2 6 8 8 5 5 6 5 7 6 7 9 10 1 3 3 3 9 7 4 6];
e=[1 3 9 10 2 4 5 6 7 8 2 6 2 8 8 6 5 8 6 5 7 5 7 6 3 3 3 9 10 1 7 9 6 4];
S=graph(v,e);
plot(S);
A=adjacency(S);
G=full(A);
G2=G;G1=G;
c2=[1 3 9 10];
G1(:,c2)=[];G1(c2,:)=[];
c1=[6 2 4 5 7 8];
G2(:,c1)=[];G2(c1,:)=[];
k=1;n=6;m=4;x1=zeros(1,6);
y=graphcolor1(G1,k,m,n,x1);
function [x]=Graphcolor(k,G,y,c,n)
while k<n+1
if(colorSafe(k,c,G,y,n))
y(k)=c;
k=k+1;
if(k<n+1 && c~=4)
y=Graphcolor(k,G,y,c+1,n);
else
if k<n+1
c=1;
y = Graphcolor(k,G,y,c+1);
end
end
end
if k==n+1
break;
end
end
x=y;
end
function [y]=colorSafe(k,c,G,x,n)
for i=1:n
if(G(k,i)==1 && c==x(i))
y=false;
else
y=true;
end
end
endKrishna Venihttps://kr.mathworks.com/matlabcentral/profile/authors/13116422-krishna-venitag:kr.mathworks.com,2005:Question/4574132019-04-19T18:27:34Z2019-04-20T09:24:39ZHow to make connected circle network in 2D on 144*144 pixel size square plane in matlab ?Hello Everyone,
I,Shubham saraf want to draw 2D image with (38*38)mm image size black pixel plane and put connected network model of circles on it, with Radius = 0.02 mm, Connected length = 0.24 mm. (1 pixel = 0.2646 mm)
what is the matlab code for it? please response me as soon as possible if any know.
Reference image which type output required, it was attached.
I used this code but get single circle output so now generate network provide loop for it.
<Matlab code:
% Create a logical image of a circle with specified
% diameter, center, and image size.
% First create the image.
imageSizeX = 640;
imageSizeY = 480;
[columnsInImage rowsInImage] = meshgrid(1:imageSizeX, 1:imageSizeY);
% Next create the circle in the image.
centerX = 320;
centerY = 240;
radius = 100;
circlePixels = (rowsInImage - centerY).^2 + (columnsInImage - centerX).^2 <= radius.^2;
% circlePixels is a 2D "logical" array.
% Now, display it.
image(circlePixels) ;
colormap([0 0 0; 1 1 1]);
title('Binary image of a circle');
end >
Thank you for your consideration.Shubham Sarafhttps://kr.mathworks.com/matlabcentral/profile/authors/13809648-shubham-saraftag:kr.mathworks.com,2005:Question/4542962019-04-04T02:11:46Z2019-04-20T08:55:34ZCan I use Microsoft Visual Studio 2019 with MATLAB R2019a or R2018b?Can I use Microsoft Visual Studio 2019 with MATLAB R2019a or R2018b?wei yanghttps://kr.mathworks.com/matlabcentral/profile/authors/15004631-wei-yangtag:kr.mathworks.com,2005:Question/3639802017-10-29T23:14:38Z2019-04-20T08:49:28ZMatlab Code for Kriging I have the average wind speed for several locations and want to use the kriging method to predict the wind speed at some random position and finally develop the wind map. Can anyone provide me with the details of how to do this in matlab because i am totally new with matlab. Attached is the data and map of the region. Thank You.
<</matlabcentral/answers/uploaded_files/92650/xxx.png>>
Kaushal Kishorehttps://kr.mathworks.com/matlabcentral/profile/authors/10503874-kaushal-kishoretag:kr.mathworks.com,2005:Question/4575012019-04-20T08:04:51Z2019-04-20T08:48:50ZUnexpected error: A timeout occurred during the write operation..while sending the data serially i am experiencing a unexpected error:
Error using serial/fprintf (line 156)
Unexpected error: A timeout occurred during the write
operation..
Error in VSigTX (line 28)
fprintf(SendData, '%s',data);
how to remove the error as the sending matrix is a very lagre matrix of about 6400000x1
Hussain Ahmadhttps://kr.mathworks.com/matlabcentral/profile/authors/9252639-hussain-ahmadtag:kr.mathworks.com,2005:Question/4571102019-04-18T07:27:00Z2019-04-20T08:36:11ZRunning a matlab file multiple times on the same computerCan I run the same version of my matlab code, simultaneously, on the same computer (with different input data and input/output folders)?
My computer has 4 cores and I want to take advantage of this. Kostas Housiadashttps://kr.mathworks.com/matlabcentral/profile/authors/15323082-kostas-housiadastag:kr.mathworks.com,2005:Question/4574412019-04-19T20:47:33Z2019-04-20T08:28:21ZHow to calculate A matrix if C1=A*C2*A' ?Dear members,
How to calculate matrix A using matlab if C1 and C2 are known?
Ahmad Fakihhttps://kr.mathworks.com/matlabcentral/profile/authors/12687262-ahmad-fakihtag:kr.mathworks.com,2005:Question/4575022019-04-20T08:27:13Z2019-04-20T08:27:13ZSorting by multiple columns in a table with natural number sortingI have a table of data that I want to sort by pair number and by trial number.
The issue is that if I use:
data = sortrows(data, {'pairNum', 'trialNum'}, {'ascend', 'ascend'});
It sorts with trial 10 being before trial 1.
However, if I try and use Stephen Cobeldick's nat sort function, I can't take into account the pair number as well as the trial number so it ends up sorting with all trial 1s, then all trial 2s etc.. (doesnt preserve the order of the pairs).
Is there a way to sort my table so that my pairs go from 1-100, and within those pairs, the trial numbers go from 1-100?
Also, I tried adding zeros to the trial numbers so that it would hopefully sort 01 before 10, but when I convert to a number using str2num and/or str2double, it gets rid of the leading zeros.
data.trialNum = strsplit(sprintf('%02d ',data.trialNum))';
Lilly Aureliushttps://kr.mathworks.com/matlabcentral/profile/authors/5748005-lilly-aureliustag:kr.mathworks.com,2005:Question/4575002019-04-20T07:38:22Z2019-04-20T08:17:11Zis WLAN toolbox available in MATLAB 2018 version?is WLAN toolbox available in MATLAB 2018 version?Rensi Mathewhttps://kr.mathworks.com/matlabcentral/profile/authors/815346-rensi-mathewtag:kr.mathworks.com,2005:Question/4574732019-04-20T02:09:26Z2019-04-20T08:13:08Zhow do I fit a double exponential equation? there are two double exponential waveforms and I need to fit the equation into each waveformThis is how the waveforms look like. I transferred the datas from Excel. The data was obtained using an oscilloscope when I compared the lightning voltage waveforms for with and without an attenuator. Now my job is to fit the double exponential equation into each of these waveforms to compare the difference for the two situations (with and without attenuator).
The double exponential equation for lightining voltage is:
Siti Fatimah Mohamed Hishamhttps://kr.mathworks.com/matlabcentral/profile/authors/15192750-siti-fatimah-mohamed-hishamtag:kr.mathworks.com,2005:Question/4569762019-04-17T16:21:05Z2019-04-20T08:09:42ZWhy does the cost function evaluate to NaN in the sensitivity analysis of my Simulink model?Hello everyone,
I am conducting a sensitivity analysis of a Simulink model of a battery, but the value of the cost function for each sample is NaN (screenshot 1). I checked and the model is able to simulate with the various samples, therefore the NaNs are caused by the warnings (screenshot 2) and errors (screenshots 3 and 4) that appear in the command window once I evaluate the model. The problem is, I don't understand what they are trying to communicate. Do you have any idea on what these errors are saying? Do you have any idea on how to fix the problem?
Angelo Chelihttps://kr.mathworks.com/matlabcentral/profile/authors/7251554-angelo-chelitag:kr.mathworks.com,2005:Question/4574932019-04-20T06:41:59Z2019-04-20T08:02:14Zlaplace(syms) leads to incorrect answer?This code nicely demonstrates my confusion:
syms t real
f=heaviside(t+1)
laplace(f)
f=heaviside(t-1)
laplace(f)
Producing the output:
f =
heaviside(t + 1)
ans =
1/s
f =
heaviside(t - 1)
ans =
exp(-s)/s
The first laplace should return exp(s)/s, yet matlab transforms as if there is not time shift?
Ryan Parkerhttps://kr.mathworks.com/matlabcentral/profile/authors/14492425-ryan-parkertag:kr.mathworks.com,2005:Question/4572582019-04-18T20:18:41Z2019-04-20T07:59:23ZHow to train and test time series data in Neural Network ToolboxHow to train and test a time series model using Neural Network toolbox in matlab?
I have a time series data having 6 variables as input and 3 variables as output. I train the data using the toolbox. Now how to test the nneural network with different set of input data?Vibin Shalom Simonhttps://kr.mathworks.com/matlabcentral/profile/authors/10821082-vibin-shalom-simontag:kr.mathworks.com,2005:Question/2572832015-11-24T18:22:20Z2019-04-20T07:47:22ZConverting unformatted text to formatted textI asked this question before and neglected some info, so I want to start fresh to avoid confusion.
I have a text file (attached) with data that is similar to data I am looking at. What I need to do is take, for example, RainflowCycleCounterHistogram[0][0]=0, and map this value, 0, to a matrix location equal to [0,0].
Then, if possible, take RainflowCycleMeanBreakpoints[0,1,2,etc] and put them on the left hand side of the matrix and RainflowCycleRangeBreakpoints[0,1,2,etc] across the top.
I am having some success using the below code, but it seems in-efficient compared to some of the other things I have seen and I get an error when I try to run it. It basically runs through the text file and picks out what I need to use. I have a structure that contains all of the arrays I need for the matrix, but it won't work because of the error I posted below. It looks like the error happens when I try accessing matrix(j).info, which doesn't make sense because when checking this array, they are just single numbers, which shouldn't cause a problem.
clear all;
close all
clc
projectdir = 'C:\Users\me\data.psr';
newdir = 'C:\Users\me\Desktop\Test1';
fid=fopen(projectdir,'r');
T=textscan(fid, '%s');
fclose(fid);
for i=8:107
a=T{1,1}{i,1};
b= a(30:48);
matrix(i).r = b(2);
matrix(i).c = b(5);
matrix(i).info = b(8:13);
end
A = zeros(9,9)
for j=8:107
A(matrix(j).r, matrix(j).c) = matrix(j).info;
end;
The error:
Assignment has more non-singleton rhs dimensions than non-singleton subscripts
Error in Untitled2 (line 23)
A(matrix(j).r, matrix(j).c) = matrix(j).info;
This answer by user Stephen Cobeldick might help, although it was created only to deal with the histogram. It gives an error when ran however.
str = fileread('temp.txt');
% identify digits:
rgx = '[A-Z]+\[(\d+)\]\[(\d+)\]:*(\d+)';
C = regexp(str,rgx,'tokens');
% convert digits to numeric:
M = cellfun(@str2double,vertcat(C{:}));
M(:,1:2) = 1+M(:,1:2);
% convert to linear indices:
out = nan(max(M(:,1)),max(M(:,2)));
idx = sub2ind(size(out),M(:,1),M(:,2));
% allocate values:
out(idx) = M(:,3)
Error using cellfun
Input #2 expected to be a cell array, was double instead.
Error in Untitled3 (line 12)
M = cellfun(@str2double,vertcat(C{:}));Ibro Tutichttps://kr.mathworks.com/matlabcentral/profile/authors/6870135-ibro-tutictag:kr.mathworks.com,2005:Question/4566162019-04-16T05:01:41Z2019-04-20T07:44:13Zhow to average data /6 rows ?how to average data /6 rows ?0.2
suryahttps://kr.mathworks.com/matlabcentral/profile/authors/15284587-suryatag:kr.mathworks.com,2005:Question/3513282017-08-02T19:48:32Z2019-04-20T07:43:00ZHow to Save And Close Excel File using actxserver?I am writing some lines of data to an Excel file and I can't seem to find a way to save and close the file, the rest of the code works. I can see the Excel file and I see that the data is written, but the file is not saving and closing, giving me the error
Error using Interface.000208DB_0000_0000_C000_000000000046/Item
Error in hub>pushbutton13_Callback (line 323)
h.workbooks.Item('C:\Users\me\export.xlsm').Save;
This is my code
h = actxserver('Excel.Application');
h.workbooks.Open('C:\Users\me\export.xlsm',0,true); %file name must also have path
h.Visible = 1
nCols = h.ActiveSheet.UsedRange.Columns.Count
nRows = h.ActiveSheet.UsedRange.Rows.Count
hSheets = h.ActiveWorkbook.Sheets;
hSheet1 = hSheets.get('Item',1);
range1a = ['A' num2str(nRows+1) ':' 'L' num2str(nRows+1)];
range1b = ['M' num2str(nRows+1) ':' 'M' num2str(nRows+1)];
range1c = ['N' num2str(nRows+1) ':' 'AM' num2str(nRows+1)];
range2a = ['A' num2str(nRows+2) ':' 'L' num2str(nRows+2)];
range2b = ['M' num2str(nRows+2) ':' 'M' num2str(nRows+2)];
range2c = ['N' num2str(nRows+2) ':' 'AM' num2str(nRows+2)];
hActivesheetRange = get(h.ActiveSheet, 'Range', range1a);
hActivesheetRange.Value = metadata;
hActivesheetRange = get(h.ActiveSheet, 'Range', range1b);
hActivesheetRange.Value = '1.0';
hActivesheetRange = get(h.ActiveSheet, 'Range', range1c);
hActivesheetRange.Value = bsfc(1,:);
hActivesheetRange = get(h.ActiveSheet, 'Range', range2a);
hActivesheetRange.Value = metadata;
hActivesheetRange = get(h.ActiveSheet, 'Range', range2b);
hActivesheetRange.Value = '2.0';
hActivesheetRange = get(h.ActiveSheet, 'Range', range2c);
hActivesheetRange.Value = bsfc(2,:);
h.workbooks.Item('C:\Users\me\export.xlsm').Save;
h.workbooks.Item('C:\Users\me\export.xlsm').Close;Ibro Tutichttps://kr.mathworks.com/matlabcentral/profile/authors/6870135-ibro-tutictag:kr.mathworks.com,2005:Question/4574972019-04-20T07:12:41Z2019-04-20T07:34:12ZCannot plot demo in javaHi everyone
I have a function used plot demo in matlab, I exported it to Java SDK and run it in eclipse IDE on Mac OS 10.14.4.
My java code in eclipse is just simple:
import com.mathworks.toolbox.javabuilder.MWException;
import plotDemo.PlotDemo;
public class Test {
public static void main( String[] args )
{
try {
PlotDemo demo = new PlotDemo();
demo.plotDemo();
} catch (MWException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
Then, when run it, I got a exception:
Exception in thread "AWT-EventQueue-0" java.lang.UnsatisfiedLinkError: Can't load library: /System/Library/Frameworks/gluegen-rt.Framework/gluegen-rt
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1827)
at java.lang.Runtime.load0(Runtime.java:809)
at java.lang.System.load(System.java:1086)
at com.jogamp.common.jvm.JNILibLoaderBase.loadLibraryInternal(JNILibLoaderBase.java:596)
at com.jogamp.common.jvm.JNILibLoaderBase.access$000(JNILibLoaderBase.java:63)
at com.jogamp.common.jvm.JNILibLoaderBase$DefaultAction.loadLibrary(JNILibLoaderBase.java:95)
at com.jogamp.common.jvm.JNILibLoaderBase.loadLibrary(JNILibLoaderBase.java:459)
at com.jogamp.common.os.DynamicLibraryBundle$GlueJNILibLoader.loadLibrary(DynamicLibraryBundle.java:421)
at com.jogamp.common.os.Platform$1.run(Platform.java:317)
at java.security.AccessController.doPrivileged(Native Method)
at com.jogamp.common.os.Platform.<clinit>(Platform.java:287)
at com.jogamp.opengl.GLProfile.<clinit>(GLProfile.java:146)
at com.jogamp.opengl.GLCapabilities.<init>(GLCapabilities.java:84)
at com.mathworks.hg.peer.JavaSceneServerPeer.getCaps(JavaSceneServerPeer.java:214)
at com.mathworks.hg.peer.JavaSceneServerPeer.doCreateCanvas(JavaSceneServerPeer.java:925)
at com.mathworks.hg.peer.JavaSceneServerPeer.access$500(JavaSceneServerPeer.java:54)
at com.mathworks.hg.peer.JavaSceneServerPeer$2.run(JavaSceneServerPeer.java:890)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758)
at java.awt.EventQueue.access$500(EventQueue.java:97)
at java.awt.EventQueue$3.run(EventQueue.java:709)
at java.awt.EventQueue$3.run(EventQueue.java:703)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:728)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:205)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
I have research on gg but can't resolve this problem. I'm a beginner, please help me.
I will appreciate your help very much. Thank you in advanceTuyen Nguyenhttps://kr.mathworks.com/matlabcentral/profile/authors/15123551-tuyen-nguyentag:kr.mathworks.com,2005:Question/4351522018-12-11T13:08:33Z2019-04-20T07:33:33ZGPU arrayfun is so slow, what is going on?Hi,
I am trying to understand what the GPU arrayfun is doing? The following is a test code.
clear;clc;close all
gd=gpuDevice();
reset(gd);
N=2e3;
a=rand(60,N,'single','gpuArray');
tic;
b=sum(a,1);
wait(gd);
toc;
tic;
c=arrayfun(@(i) sum(a(:,i),1),(1:N));
wait(gd);
toc;
The results are:
Elapsed time is 0.000468 seconds.
Elapsed time is 0.584521 seconds.
What is going on here? 1000 times difference?? I would expect similary runtime since GPU arrayfun is supposed to be executed parallel on GPU cores. Did I make stupid errors on using the arrayfun?
Thanks!Hao Zhanghttps://kr.mathworks.com/matlabcentral/profile/authors/2574469-hao-zhangtag:kr.mathworks.com,2005:Question/4574952019-04-20T07:04:02Z2019-04-20T07:26:38Zhow to normalize the data at that time?hello , im surya.. I have difficulty processing data..
how to normalize the data at that time?, I want to enter the time per 10 minutes
'Date Time' 'RR'
'12/06/2015' 0:00:00' 10
'15/06/2015' 0:00:00 '10.2'
'15/06/2015 0:10:00' '10.8'
'16/06/2015' 0:00:00' '10.6'
'16/06/2015 6:10:00' '10.2'
'16/06/2015 6:20:00' '10.4'
'16/06/2015 8:00:00' '10.4'
'16/06/2015 8:10:00' '11.2'
'16/06/2015 8:20:00' '11.2'
'16/06/2015 8:30:00' '11.2'
'16/06/2015 8:50:00' '11.2'
'16/06/2015 9:00:00' '11.2'
etc
example: the bold one wants to be normalized per 10 minutes so at 8:40 a.m. so at 8:40 a.m. 'RR value is filled with NaN. and on '12/06/2015 '0:00:00' to '14/06/15 23:50:00 filled with Nan ... thank yousuryahttps://kr.mathworks.com/matlabcentral/profile/authors/15284587-suryatag:kr.mathworks.com,2005:Question/4573222019-04-19T06:36:05Z2019-04-20T07:26:09ZAdding multiple fields and values to structure array I have a code in which I am looping through many files, and for each file, I'm adding fields and values to a structure array.
The code is quite repetitive and I'm wondering if there is a way to shorten it a bit.
Right now it looks like this:
data(k).pairNum = pairNum;
data(k).level = level;
data(k).trialNum = trialNum;
data(k).success = win;
data(k).numWins = numWins;
data(k).totalTime = totalTime;
data(k).timeUntilSuccess = timeUntilSuccess;
data(k).totalTime = totalTime;
data(k).initialSpread = initialSpread;
data(k).initialCOM = initialCOM;
data(k).D1_distance = D1_distance;
data(k).D2_distance = D2_distance;
But im just curious if there is a way to make it work by doing something like this:
data(k).[pairNum, level, trialNum, win, numWins, totalTime] = pairNum, level, trialNum, win, numWins, totalTime;
Lilly Aureliushttps://kr.mathworks.com/matlabcentral/profile/authors/5748005-lilly-aureliustag:kr.mathworks.com,2005:Question/4543392019-04-04T08:05:44Z2019-04-20T07:21:33ZGA violates the linear inequality constraintsHi. I have mixed integer non-linear optimization problem with two optimization variables, each of size K*M*N. For now I have tried the linear inequality constraitns. The result of opt. variable does not meet the constraints.
I have attached the complete code. Please highlight the issues.
Also, can ga solve this problem?
Thanking you in advance.Umber Saleemhttps://kr.mathworks.com/matlabcentral/profile/authors/15192456-umber-saleemtag:kr.mathworks.com,2005:Question/4574922019-04-20T06:39:06Z2019-04-20T07:20:44Ztoo many input argument while plotting date and time
i want to plot this on matlab. the code i am trying is
[~,~,v]=xlsread('solarg55.xlsx')
v=v(2:end,:);
x=datenum(v(:,1),'dd/mm/yyyy HH:MM:SS')
y=cell2mat(v(:,2))
[idx,idx]=sortrows([x,y])
plot(x(idx),y(idx))
xticks=get(gca,'Xtick')
set(gca,'xticklabel',datestr(xticks,'dd/mm/yyyy HH:MM:SS'))
but it gives me this error
Error using date
Too many input arguments.chanz agrawahttps://kr.mathworks.com/matlabcentral/profile/authors/13704756-chanz-agrawatag:kr.mathworks.com,2005:Question/4574982019-04-20T07:16:03Z2019-04-20T07:16:03Znativemcc.dll: %1 is not a valid Win32 applicationI am learning how to compile a Matlab script into an executable.
I follow every step given for the example magicsquare.m in Matlab Compiler User's Gulde for R2016a
"Create Standalone Application from MATLAB" pages 1-5 to 1-7.
At the last step, Click Package, I get this error:
java.lang.UnsatisfiedLinkError: C:\Program Files\MATLAB\R2016b\bin\win64\nativemcc.dll: %1 is not a valid Win32 application.
I am running Matlab 2016b on Windows 10.
Can't find any relevant link for a solution. Can someone please help? Anthony Chanhttps://kr.mathworks.com/matlabcentral/profile/authors/12525953-anthony-chantag:kr.mathworks.com,2005:Question/4560522019-04-12T16:31:00Z2019-04-20T07:11:29Zhow to separate date and time into 6 tables 01/01/2014 0:10:00? (year,month,day,hours,minutes and second)how to separate date and time into 6 tables 01/01/2014 0:10:00? (year,month,day,hours,minutes and second)suryahttps://kr.mathworks.com/matlabcentral/profile/authors/15284587-suryatag:kr.mathworks.com,2005:Question/4574482019-04-19T21:30:23Z2019-04-20T07:04:57ZHow to calculate the accumulated rainfall value of 1, 2, 3, 4, 5, 6 and 7 days.I need to calculate the cumulative rainfall of 1, 2, 3, 4, 5, 6 and 7 days and extract the annual maximum of each year (after accumulation). I have historical series of precipitation with a great amount of years organized as follows: day, month, year, precipitation [mm], each in a column. I tried using the code below but it did not work.
%% Import Precipitation Data
RainMatrix = importdata ('data.txt');
% Identifies the first and last year of the series
First_Year = RainMatrix(1,3);
Last_Year = RainMatrix(end,3);
% Measuring the Data Series Size;
T = length(unique(RainMatrix(:,3)));
P = 2; % Time Step, P = 1, 2, 3, 4, 5, 6 and 7 days
k = 1; % Counter
for ii = 1 : (T-1)
Year = find(RainMatrix(:,3) == First_Year); % Identifies the year
RainMatrix = RainMatrix(Year(:,1),:); % Cut the year
n = length(RainMatrix); % Dimension of Cut Out Data
for i = P : P : n
Rainfall(k,1) = sum(RainMatrix(i-P+1:i,4)); % Cumulative rainfall of "P" days
k = k+1;
[x, y] = ismember(max(Rainfall(:,1)),Rainfall(:,1)); % Find the Maximum Value of the Series
MaxAnual(ii,1) = Rainfall(y);
end
First_Year = First_Year + 1;
Rainfall = [];
end
GAhttps://kr.mathworks.com/matlabcentral/profile/authors/6927127-gatag:kr.mathworks.com,2005:Question/4574942019-04-20T06:53:00Z2019-04-20T06:53:00Zsignal processing in sampled datai have a signal as different values of voltage. this are only values of different voltages. in this signal there is noise and i want to remove the noise but whenever i use any filter it does not filter the signal. how do i filter the signal? when ever i plot it. is is plotted as voltage vs. samples.
i want to filter and process this signals.Jignesh Mistryhttps://kr.mathworks.com/matlabcentral/profile/authors/9091497-jignesh-mistrytag:kr.mathworks.com,2005:Question/4574752019-04-20T02:55:59Z2019-04-20T06:32:05ZHow to classify more than one object in an imageI'm trying to classify different class of cracks on glass for my project but the current code seems to only able to detect one class instead of multiple on the same image. The classes i'm trying to detect are linear and radial cracks. I've train the images accordingly. I'm using a custom GUI figure to display the results. Does anyone know what I can do to get the program to detect multiple class of object in one image. Attached are the related images and m files.
% --- Executes on button press in pushbutton1.
function pushbutton1_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
handles.output = hObject;
[a b] = uigetfile({'*.*'});
img = imread([b a]);
imshow(img,'Parent',handles.axes1);
grayy = rgb2gray(img);
gr = graythresh(grayy);
bw = im2bw(grayy,gr);
handles.bi = bwareaopen(bw,250);
guidata(hObject,handles);
% --- Executes on button press in pushbutton2.
function pushbutton2_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
handles.output = hObject;
imshow(handles.bi, 'Parent',handles.axes2)
hold on;
boundaries = bwboundaries(handles.bi);
numberOfBoundaries = size(boundaries, 1);
for k = 1 : numberOfBoundaries
thisBoundary = boundaries{k};
plot(thisBoundary(:,2), thisBoundary(:,1), 'g', 'LineWidth', 2);
end
hold off;
[rows,cols] = size(handles.bi);
Ftest=FeatureStatistical(handles.bi);
load db.mat
Ftrain=db(:,1:2);
Ctrain=db(:,3);
for (i=1:size(Ftrain,1));
dist(i,:)=sum(abs(Ftrain(i,:)-Ftest));
end
m=find(dist==min(dist),1);
stats = regionprops(handles.bi,'BoundingBox','Centroid');
bb = stats.BoundingBox;
bc = stats.Centroid;
for row = 1:rows
for (i=1:size(Ftrain,1));
dist(i,:)=sum(abs(Ftrain(i,:)-Ftest));
end
m=find(dist==min(dist),1);
Round = m <=10;
if Round
hold on
rectangle('Position',bb,'EdgeColor','r','LineWidth',2)
plot(bc(1),bc(2))
else
hold on
rectangle('Position',bb,'EdgeColor','b','LineWidth',2)
plot(bc(1),bc(2))
end
end
hold off
guidata(hObject,handles);
NRDhttps://kr.mathworks.com/matlabcentral/profile/authors/7863772-nrdtag:kr.mathworks.com,2005:Question/4574772019-04-20T03:36:05Z2019-04-20T06:28:08ZHow to trouble shoot a crashing error upon startup of Matlab?Hello, I've been using Matlab consistently on on my laptop for the past year. But in the last couple of days it has been crashing immediately upon openning. And by that I mean that I'll try to run matlab.exe and all that happens is that the icon flashes very briefly in the task bar at the bottom of the screen. No error message is given. So it seems to me like Matlab is crashing before it even has a chance to bring up the logo. It started with 2018b, then I updated to 2019a, then I uninstalled both 2018b and 2019a and did a reinstall of 2019a. I restarted my computer in between each, but the issue is still occuring. I have also tried running in admin mode. I'm running windows 10.
EDIT: I fixed the issue following steps found here:
https://www.mathworks.com/matlabcentral/answers/97167-why-will-matlab-not-start-up-properly-on-my-windows-based-systemYoujia Wanghttps://kr.mathworks.com/matlabcentral/profile/authors/12943340-youjia-wangtag:kr.mathworks.com,2005:Question/4563082019-04-14T18:51:56Z2019-04-20T06:27:42ZHow to split the string with Mathematical operators?I have equations:
a = '(Id_M5)/Cc'
b =' (VDD-VSS)*(Id_M5+(2*(Id_M7)))'
How to split these?
I want answers like:
a = [Id_M5 Cc]
b = [VDD VSS Id_M5 2 Id_M7]
Harsha M Vhttps://kr.mathworks.com/matlabcentral/profile/authors/8626163-harsha-m-vtag:kr.mathworks.com,2005:Question/4574892019-04-20T05:51:27Z2019-04-20T06:20:43ZNeed help creating an 2-D 400×300 arrayNeed help creating a meshgrid() to create a 2-D 400×300 array of numbers. I want to design an interesting function like the product of two sine functions using the array values as inputs. I want to a create a grayscale image of this function with imagesc(). and also add a colorbar and label both axes. I also need to change the values of the array elements [100:110, 50:60] to make something that will be visible in the image. Much appreciated for the help.JChttps://kr.mathworks.com/matlabcentral/profile/authors/8891840-jctag:kr.mathworks.com,2005:Question/4574902019-04-20T06:07:06Z2019-04-20T06:12:31Zwhy getpts doesn't give the correct points?I have the following image:
When I plot the points got by getpts, the image is flipped upside down:
My code is the following:
figure
imshow("carro.png")
[x,y] = getpts;
plot(x,y,'b*')David Armendárizhttps://kr.mathworks.com/matlabcentral/profile/authors/12396148-david-armendariztag:kr.mathworks.com,2005:Question/4574862019-04-20T05:33:30Z2019-04-20T06:12:24ZDBSCAN problems: add capcacity violation condition to identify a core point in a cluster Main idea: If P is core node , nodes which are density-reachable from P, are labelled the same cluster number. Further expansion goes on. If the node P is boundary object and total load after merging P exceeds the capacity of vehicle, abandon p and calculate next node. Proceed in order till a cluster produced. Repeat the process till all nodes are labelled.
I check the violation capacity in function ExpandCluster. However, some clusters still over capacity. When i check the IDX which has two colum: col1 is cluster ID of node, col2 is capacity of the node.
I use cumsum capacity of cap_array when ever add in a node into cluster to find the node that will violate a cluster total capacity.
function [IDX, isnoise]=DBSCAN_capac_test(X,epsilon,Mi
nPts,vehicle_capacity)
X=load('A-n45-k7-100-1146.txt');
C=0;%cluster lables initialize
% IDX=zeros(n,1);
Y=X;
Y(1,:)=[]; %exclude depot
Cap=0;%capacity of cluster initialize
n=size(Y,1); %n is customer location( row)
IDX=zeros(n,2); %assume every customer grow 1 cluster/
%decalre cluster id of each customer and
x1=Y(:,2:3);%data matrix
y1=Y(:,4);%demand matrix
epsilon=16;
MinPts=5;
vehicle_capacity=50;
D=pdist2(x1,x1);
sumCapacity=zeros(n,1);
idx=zeros(n,1);
cap_array=zeros(n,1)
visited=false(n,1); % produce array of logical false for example, false(2) logical 2x2 zero array
isnoise=false(n,1);% array of logical false
for i=1:n
if ~visited(i)
visited(i)=true;
Neighbors=RegionQuery(i);
if (numel(Neighbors)<MinPts) & (Y(i,4)>vehicle_capacity)
% X(i,:) is NOISE
isnoise(i)=true;
else
C=C+1;
ExpandCluster(i,Neighbors,C,sumCapacity); %after choose a core point then create cluster form the chosen core point
end
end
function ExpandCluster(i,Neighbors,C,sumCapacity)
IDX(i,1)=C; % cluster id/ i = core point chosen
IDX(i,2)=Y(i,4);
sumCapacity(i)=Y(i,4);
k = 1;
while true
j = Neighbors(k);
if ~visited(j)
visited(j)=true;
Neighbors2=RegionQuery(j); %neighbor j in cluster
sumCapacity(j)=Y(j,4);
sumCapacity(sumCapacity==0)=[];
cap_array=cumsum(sumCapacity(1:end));
cap=cap_array(end); %capacity of the current point
if (numel(Neighbors2)>=MinPts) & (cap<vehicle_capacity)
Neighbors=[Neighbors Neighbors2]; %#ok add into cluster
elseif (numel(Neighbors2)>=MinPts) & (cap>vehicle_capacity)
break
end
end
if IDX(j,1)==0
IDX(j,1)=C;
end
k = k + 1;
if k > numel(Neighbors) % k run due to number of seeds in cluster C
break;
end
end
end
function Neighbors=RegionQuery(i)
Neighbors=find(D(i,:)<=epsilon);
end
disp('IDX');
disp(IDX);
disp('isnoise');
disp(isnoise);
%tao index theo cluster cho tung idx
disp(cap);
disp(cap_array);
end
Quynh Lyhttps://kr.mathworks.com/matlabcentral/profile/authors/15175677-quynh-lytag:kr.mathworks.com,2005:Question/4573062019-04-19T02:50:03Z2019-04-20T06:03:52ZArtificial Neural Network implementation and to know the importance of each of the input on output(Response) - wanted helpI Conducted 27 experiments for a 10-factor,3-level design of experiments. I conducted these experiments on a decentralized production-distribution supply chain on a desktop computer to understand the effect (importance) of each of the 10 factors on the total supply chain cost (Response).
These experiments are computer simulations.
The 10 factors considered were namely, Tardiness cost (shortage cost at customer zone) ,(TarC), Earliness cost at the Distribution centre (EarC), Transportation cost between factories and Distribution centers (TransFDC), Transportation cost between Distribution centers and Customer Zones (TransDCCU), Production Cost of Products at Factory (ProdC), Inventory holding cost at factory (InvC), Unfulfilled cost (Shortage cost at factory (UnfulfillC), capacity of factory (CapaF), Maximum earliness allowed (Capae), Inventory holding capacity at factory(Capaif)
For each of the 10 factors, I have chosen 3-levels (1,2,3).
1-represents low,2-represents medium, 3-represents high.
I have assigned values for these 3 levels for each of the 10-factors as shown in Table.1(Attachment) . For instance for Tardiness Cost (1stfactot).,i.e, TarC, level 1 represents a value between 100 and 500. For the same TarC , level-2 represents a value between 500 and 1000. Level-3 for TarC represents a value between 1000 and 5000. Like above, the 3-level values have been assigned for all the 10-factors.
The settings of parameters for conducting experiments have been shown in Table.2.(Attachment)
The Total cost (Table.3) of the Decentralized supply chain has been obtained by solving the above 10-factor experiments using a G.A.M.S. modeling language for optimizing the cost. The total cost (Response) for the 27 experiments was shown in Table.3.(Attachment)
I want to implement the above inputs(factors), Targets(Responses) in Artificial Neural Network of MATLAB to know the impact (importance) of each of the 10-factors on total cost (Response) of the decentralized supply chain.
can somebody help me in implementing the data shown in the attachment for using ANN to know the importance of each of the 10 factors on total supply chain costKallam Haranadha Reddyhttps://kr.mathworks.com/matlabcentral/profile/authors/5909596-kallam-haranadha-reddytag:kr.mathworks.com,2005:Question/4574222019-04-19T19:06:01Z2019-04-20T05:58:32Zseparate table data in to sub tables Hi everyone
I have a table of data the size of 10000x3. There are 300 different names used in the rows. I would like to seperte the variables that have the same name and make a tabel for each variable.
for example if the table below is my original table :
name Variable1 variable2 variable3
A variable1_A1 variable2_A2 variable3_A3
B variable1_B1 variable2_B2 variable3_B3
K variable1_K1 variable2_K2 variable3_K3
L variable1_L1 variable2_L2 variable3_L3
A variable1_A4 variable2_A5 variable3_A6
A variable1_A7 variable2_A8 variable3_A9
L variable1_L4 variable2_L5 variable3_L6
I need to devide it to 4 differnt tables (one for each name):
name Variable1 variable2 variable3
A variable1_A1 variable2_A2 variable3_A3
A variable1_A4 variable2_A5 variable3_A6
A variable1_A7 variable2_A8 variable3_A9
name Variable1 variable2 variable3
L variable1_L1 variable2_L2 variable3_L3
L variable1_L4 variable2_L5 variable3_L6
Thank you in advance for your help!ALDOhttps://kr.mathworks.com/matlabcentral/profile/authors/6213802-aldotag:kr.mathworks.com,2005:Question/4574452019-04-19T21:15:37Z2019-04-20T05:55:27ZWriting equations in a matrix formHi MATLAB experts,
Could any one please help me to write-down the following equations into a matrix form? the initial value of c = zeros(I, L, K, M)
0<= c(i, j, k, m) <= 1 for all k= {1, 2, ...., K} and m = {1, 2, ..., M} and i = {1,...., I} and j = {1,..., L}
0<=sum_{j} sum_{i} c(i,j,k,m) <= 1 for all k= {1, 2, ...., K} and m = {1, 2, ..., M}Su sanhttps://kr.mathworks.com/matlabcentral/profile/authors/14788079-su-san